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