Homestead 2.0多个站点,都链接到同一个URL

时间:2014-11-29 21:10:02

标签: laravel hosts-file

嘿伙计们,小问题:所以我设置了Homestead 2.0,一切正常。我想在同一代码目录中添加另一个项目,但将其链接到另一个url。所以我在网站列表中添加了它但是当我访问laravel.app时它一切正常,但是当我访问larabook.app时它会显示laravel.app页面!这两个网址都链接到我的/ etc / hosts文件中的192.168.10.10。

我尝试重启我的mac并重新启动虚拟机,但没有任何工作:'(

的/ etc /主机

192.168.10.10 laravel.app
192.168.10.10 larabook.app

Homestead.yaml

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
    - map: laravel.app
      to: /home/vagrant/Code/Laravel/public
    - map: larabook.app
      to: /home/vagrant/Code/Larabook/public

databases:
    - homestead
    - larabook

3 个答案:

答案 0 :(得分:37)

假设您的Homestead.yaml文件在上面

输入:

$ vagrant global-status

将显示类似的内容;

id    name      provider   state   directory    
--------------------------------------------    
77c5c30  default   virtualbox running et....    

输入:

$ vagrant provision 77c5c30

当然这假设您只有1个VM,如果您有其他人,那么在您运行vagrant provision时读取该指令

答案 1 :(得分:2)

这对我有用,并没有丢失数据库:

$ homestead halt
$ homestead up --provision

答案 2 :(得分:0)

尝试

folders:
    - map: ~/Code/Laravel
      to: /home/vagrant/Code/Laravel

    - map: ~/Code/Larabook
      to: /home/vagrant/Code/Larabook

sites:
    - map: laravel.app
      to: /home/vagrant/Code/Laravel/public
    - map: larabook.app
      to: /home/vagrant/Code/Larabook/public

databases:
    - homestead
    - larabook

注意:查看我对文件夹部分所做的更改。 从https://www.easylaravelbook.com/blog/configuring-multiple-laravel-homestead-sites-and-databases/#top

中查找更多信息
after run
    $ homestead halt
    $ homestead up --provision