假设本地虚拟机ip为 192.168.23.128,如果想使用www.test01.com这个域名访问虚拟中的web服务器,只需要进行如下配置:
windows中,编辑 C:\Windows\System32\drivers\etc\hosts 文件,添加如下内容:
# nginxTest
192.168.23.128 www.test01.com
# End nginxTest
linux中,编辑 /etc/hosts 文件,添加如下内容:
# nginxTest
192.168.23.128 www.test01.com
# End nginxTest