How configure Homestead and xip.io?

天涯浪子 提交于 2019-11-29 15:31:53

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

To understand how it works you need to know two facts:

  • Domain example.your_ip.xip.io resolves to your_ip.
  • By default local port 8000 is mapped to port 80 of your homestead virtual machine.

Please note, xip.io acts as a "DNS" and you don't need to edit your hosts file to access your homestead site from other devices on local network.

This solution works perfectly if you have only one site mapped in homestead. If there are multiple sites, only last mapped site gets served. A workaround is to use site identifier in your url. http://<your_site>.<your_local_ip>.xip.io:8000 still resolves to same endpoint but now you can update your homestead nginx to pickup the site identifier and serve the right site.

I believe Homestead already ships with it by default,

in my case i just added an entry on the hosts files, /etc/hosts (i'm on a mac machine), like this:

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

(usually the default port is 8000), and then add an entry on the homestead yml config file (you can reach by typing homestead edit on your console.

and that should do it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!