My machine and Android devices are on the same network.
192.168.0.11
192.168.10.10
If I enter 192.168.0.11:8000
on my Android device I can use only one site.
How can I enter all sites stored in Homestead?
This is my Homestead.yaml
file:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Homestead-Projects
to: /home/vagrant/Homestead-Projects
sites:
- map: site1.com
to: /home/vagrant/Homestead-Projects/Site1/public
- map: site2.app
to: /home/vagrant/Homestead-Projects/Site2/public
databases:
- homestead
- db_site1
- db_site2
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
This is my hosts
file:
127.0.0.1 localhost
127.0.1.1 host
#Virtual Hosts on Homestead
192.168.10.10 site1.com
192.168.10.10 site2.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. Vagrant provides a simple, elegant way to manage and provision Virtual Machines.
You have to add a row for each site in your host file on the remote machine (just like in the server where Homestead is running) but with the server's IP adress. Then just type sitename.local:8000
.
In your case the server's IP is 192.168.0.11
. Within this server, Homestead serves requests on 192.168.10.10
. So in the host file of the server you have these lines:
192.168.10.10 site1.com
192.168.10.10 site2.com
You have to copy these rows to the remote PC's host file and then replace the IP address with the server's IP: 192.168.0.11
.
192.168.0.11 site1.com
192.168.0.11 site2.com
Depending on your OS you may have to restart the PC or the DNS service. After that, you can access the sites from the remote PC in these addresses:
site1.com:8000
site2.com:8000
Keep in mind that editing (writing) the hosts file requires superuser/administrator permissions. This is easy to solve in a PC, if you have access to the administrator account, but can be complicated on a mobile device. For Android check out these questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With