How to configure Homestead and xip.io?

I want to access from other devices (iphone, Android devices, etc.) to my sites on the estate on my machine. My machine and all devices are on the same network.

I want to use http://xip.io , but I could not build it.

My ip device is 192.168.0.12

IP for sites on Homestead - 192.168.10.10

These are the host files:

127.0.0.1 localhost 127.0.1.1 host #Virtual Hosts on Homestead 192.168.10.10 siteOne.com 192.168.10.10 siteTwo.app 192.168.10.10 otherSite.app # 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 

and this is Homestead.yaml

 --- 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: siteOne.com to: /home/vagrant/Homestead-Projects/SiteOne/public - map: siteTwo.app to: /home/vagrant/Homestead-Projects/SiteTwo/public - map: otherSite.app to: /home/vagrant/Homestead-Projects/OtherSite/public databases: - homestead - db_siteOne - db_siteTwo - db_otherSite 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 

How can i do this?

Thanks!

+2
source share
2 answers

You can access your site by going to the page http://<your_local_ip>.xip.io:8000 .

To understand how this works, you need to know two facts:

  • Domain example.your_ip.xip.io allows your_ip .
  • By default, the local port 8000 maps to port 80 your home virtual machine.

Please note that xip.io acts as a β€œDNS” and you do not need to edit the hosts file to access your estate site from other devices on the local network.

This solution works fine if you only have one site mapped to a homestead. If there are multiple sites, only the last matching site is served. The workaround is to use the site identifier in your URL. http://<your_site>.<your_local_ip>.xip.io:8000 is still resolving with the same endpoint, but now you can update your homestead nginx to pick up the site id and serve the correct site.

+2
source

I believe that Homestead already comes with it by default,

In my case, I just added an entry to the hosts files, / etc / hosts (I'm on a Mac machine), for example:

 127.0.0.1 http://app.ip.address.xip.io:8000 

(usually the default port is 8000), and then add an entry to the yest homestead configuration file (you can get it by typing homestead edit on the console.

enter image description here

and it has to be done.

+1
source

Source: https://habr.com/ru/post/976162/


All Articles