How to test sub-domains on my localhost on a mac?

寵の児 提交于 2019-12-23 09:15:48

问题


I have set up a web application on I am running it on my localhost. That is - http://127.0.0.1:8000/. I have set up sub-domains as well. For example, going to http://blog.127.0.0.1:8000/ should take me to the blog part. However, my browser does not recognize this and says server cannot be found. My OS is MACOSx

If you want to test subdomains on your local host, you need your browser to resolve multiple subdomains as '127.0.0.1'. The way you do this depends on your OS. If you're using linux, you would edit /etc/hosts.

I got this bit of info from another user, however, I have no idea how to do this on my Mac. Any help is appreciated.


回答1:


Edit the file /etc/hosts, add the following line:

127.0.0.1 example.com blog.example.com

Then try http://example.com:8000/ and http://blog.example.com:8000/



来源:https://stackoverflow.com/questions/38905207/how-to-test-sub-domains-on-my-localhost-on-a-mac

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