我已经阅读了许多帖子,并为同一 IP 地址上的 2 个站点配置了 WAMP,如下所示(httpd.conf 提取):
#Tell Apache to identify which site by name
NameVirtualHost *:80
#Tell Apache to serve the default WAMP server page to "localhost"
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/wamp/www"
</VirtualHost>
#Tell Apache configuration for 1 site
<VirtualHost 127.0.0.1>
ServerName client1.localhost
DocumentRoot "C:/wamp/www_client1"
<Directory "C:/wamp/www_client1">
allow from all
order allow,deny
AllowOverride all
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
#Tell Apache configuration for 2 site
<VirtualHost 127.0.0.1>
ServerName client2.localhost
DocumentRoot "C:/wamp/www_client2"
<Directory "C:/wamp/www_client2">
allow from all
order allow,deny
AllowOverride all
</Directory>
我还更改了 Windows 主机文件以添加 127.0.0.1 client1.localhost 等,但是当我重新启动 WAMP 服务时, //client1.localhost 和 //client2.localhost 会转到 c:\wamp\www 中的默认站点文件夹。
任何帮助都非常感谢。