我已经在我的 Windows 机器上安装了 XAMPP - 我试图在虚拟主机文件中运行多个网站,但无论我似乎这样做,我一次只能运行一个网站。例如,要运行站点 3,我需要注释掉对站点 1 和 2 的所有引用(反之亦然)。
谁能解释我做错了什么?
我的 v/hosts 文件如下:
<VirtualHost *:80>
ServerName s1.localhost
ServerAlias s1.localhost
DocumentRoot "C:/xampp/htdocs/site1/public_html"
<Directory "C:/xampp/htdocs/site1/public_html">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName s2.localhost
ServerAlias s2.localhost
DocumentRoot "C:/xampp/htdocs/site2/public_html"
<Directory "C:/xampp/htdocs/site2/public_html">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName s3.localhost
ServerAlias s3.localhost
DocumentRoot "C:/xampp/htdocs/site3"
<Directory "C:/xampp/htdocs/site3">
AllowOverride All
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
我的 Windows 主机文件:
127.0.0.1 s1.localhost
127.0.0.1 s2.localhost
127.0.0.1 s3.localhost