WAMP下面配置多台虚拟主机,其他计算机如何控制访问哪个网站?

httpd-vhosts.conf下配置vhost两个

<VirtualHost *:80>
    DocumentRoot "G:\PhpDemo"
    ServerName "localhost"
    <Directory "G:\PhpDemo">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted 
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "G:\MVC"
    ServerName "www.mvc.com"
    <Directory "G:\MVC">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted 
    </Directory>
</VirtualHost>

在windows的host文件中也添加了对应的配置

127.0.0.1       localhost
127.0.0.1       www.mvc.com

但是其他计算机通过ip访问本机还是localhost,如何让其他机器访问到www.mvc.com?

阅读 2.1k
1 个回答

其他机器上需要绑定你机器ip的host。域名就是www.mvc.com

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题