如果您正在阅读我的问题,谢谢,感谢您的帮助
我在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>
有人可以建议我如何做到这一点吗?
答案 0 :(得分: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>
答案 1 :(得分:3)
这是一个完整的教程,希望它有所帮助。如果您遇到任何问题,请告诉我。
http://kintek.com.au/blog/configuring-multiple-domains-within-wamp-for-local-development/