Search code examples
laravelhosts-file

Homestead 2.0 multiple sites, all link to the same url


Hee guys, little question: So i have setup the Homestead 2.0 and everything is working fine. I wanted to add another project in the same code directory but link it to another url. So i added it in the sites list but when i visited laravel.app it all works fine, but when I visit larabook.app it shows me the laravel.app page! Both urls are linked to 192.168.10.10 in my /etc/hosts file.

I have tried restarting my mac and restarting the vm but nothing is working :'(

/etc/hosts

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

Solution

  • Assuming your Homestead.yaml file above

    type in:

    $ vagrant global-status
    

    will display something like;

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

    type in:

    $ vagrant provision 77c5c30
    

    Of course this assumes you only have 1 VM, if you have others then read the instruction when you run vagrant provision