Search code examples
laravelnetwork-programminglocalhomestead

Laravel homestead multiple sites choose which one is locally accesable


I have multiple sites in laravel homestead. Now, I want to access a spezific site via the ip in my local network. But I get allways the site I dont want...

homestead.yaml

sites:
- map: mdb.local
  to: /home/vagrant/code/mdb/public
  type: "apache"

- map: zz.tested
  to: /home/vagrant/code/abc/public
  type: "apache"

- map: 192.168.10.10
  to: /home/vagrant/code/mdb/public

And my hosts

192.168.10.10 mdb.local
192.168.10.10 zz.tested

I can access both on my computer with the domain, however I allways get abc over the ip in the local network. What do I have to change to get mdb on mobile and abc is accessable only on my computer?

I've read this StackOverflow Question but - you can see my implementation of this solution - it doesn't help to solve this problem.


Solution

  • Apache always takes the first site alphabetically and returns that as the default host. What you can do is to make a host called 000default or similar, which will then be returned when there's no hostname.