2

如果您正在阅读我的问题,谢谢,感谢您的帮助

我在 Windows Vista 上使用 Wamp。

我创建了 2 个项目文件夹:

www/project1/ 
www/project2/

我的虚拟主机文件如下所示:

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/project1/"
    ServerName project1.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/project2/"
    ServerName project2.com
</VirtualHost>

有人可以建议我如何去做吗?

4

2 回答 2

3

您需要在 VirtualHost 中为每个主机名指定 ServerName(以及另外的 ServerAlias):

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host1.localhost"
    ServerAlias *.first.com first.com
    ServerName www.first.com
    ErrorLog "logs/dummy-host1.localhost-error.log"
    CustomLog "logs/dummy-host1.localhost-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
    ServerAlias *.second.com second.com
    ServerName www.second.com
    ErrorLog "logs/dummy-host2.localhost-error.log"
    CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
于 2009-10-04T11:09:34.500 回答
3

这是完整的教程,希望对您有所帮助。如果您遇到任何问题,请告诉我。

http://kintek.com.au/blog/configuring-multiple-domains-within-wamp-for-local-development/

于 2010-11-25T01:24:29.450 回答