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?
其他机器上需要绑定你机器ip的host。域名就是www.mvc.com