3

I have two Laravel projects on a Homestead machine.

Homestead.yaml

sites:
- map: homestead.app
  to: /home/vagrant/Code/Laravel/public
- map: blog.app
  to: /home/vagrant/Code/Blog/public

and /etc/hosts:

192.168.10.10   homestead.app
192.168.10.10   blog.app

And everything works as expected. But when I want to access sites from a phone on a local network and go to

192.168.1.100:8000

It takes me to a Blog project. Is there a way for all projects to be accessible at all times?

I read this How to connect to Homestead which has multiple sites through mobile device?, but you have to pick one project to be accessible. And you have to edit Homestead.yaml and reload vagrant every time you want to swap projects.

Community
  • 1
  • 1
Levent
  • 31
  • 5
  • Its correct.. You can't access the multiple sites configured in homestead. If you want to access, you may try the services like ngrok. – Anandhan Nov 07 '16 at 16:57
  • @Anandhan, do you know *why* you can't? With port forwarding and hosts files, this doesn't seem like something that should be impossible. – Trip Dec 08 '18 at 20:08

1 Answers1

0

I have just figured this out myself, and I have posted answers here (Homestead cant access second site remotely) and here (Laravel homestead multiple sites choose which one is locally accesable).

In short:

sites:
- map: homestead.app
  to: /home/vagrant/Code/Laravel/public
  port: 81
- map: blog.app
  to: /home/vagrant/Code/Blog/public

ports:
  - send: 8100
    to: 81

Then access your homestead.app project via http://192.168.1.100:8100.

Trip
  • 2,018
  • 15
  • 27
  • The one caveat: From the host machine, you would obviously need to access the `homestead.app` application on port 81 instead of the normal default of 80. – Trip Dec 13 '18 at 03:08