我在创建多个虚拟主机时遇到问题,我将 C:\wamp\alias\web.local 编辑为如下所示:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@website1.local
DocumentRoot "C:/Documents and Settings/username/workspace/www.website1.com"
ServerName website1.local
<Directory "C:/Documents and Settings/username/workspace/www.website1.com">
DirectoryIndex index.php index.htm index.html
Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@website2.local
DocumentRoot "C:/Documents and Settings/username/workspace/www.website2.com"
ServerName website2.local
<Directory "C:/Documents and Settings/username/workspace/www.website2.com">
DirectoryIndex index.php index.htm index.html
Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@website3.local
DocumentRoot "C:/Documents and Settings/username/workspace/www.website3.com"
ServerName website3.local
<Directory "C:/Documents and Settings/username/workspace/www.website3.com">
DirectoryIndex index.php index.htm index.html
Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@website4.local
DocumentRoot "C:/Documents and Settings/username/workspace/www.website4.com"
ServerName website4.local
<Directory "C:/Documents and Settings/username/workspace/www.website4.com">
DirectoryIndex index.php index.htm index.html
Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我的主机文件如下所示:
127.0.0.1 localhost
127.0.0.1 website1.local
127.0.0.1 website2.local
127.0.0.1 website3.local
127.0.0.1 website4.local
我重新启动了 Wampserver,但似乎无法访问 website1.local、website2.local、website3.local 或 website4.local。我收到“网络错误(dns_unresolved_hostname)”错误消息。
请注意localhost是唯一一个似乎可以工作的。
任何帮助表示赞赏。
问候,斯蒂芬
编辑
我在 Windows XP 上运行 Wampserver 2.2。