简体   繁体   English

WAMP本地主机上的多个域

[英]Multiple-domains on WAMP localhost

If you're reading my question, thanks, I appreciate your help 如果您正在阅读我的问题,谢谢,感谢您的帮助

I'm using Wamp on Windows Vista. 我在Windows Vista上使用Wamp。

I've created 2 project folders: 我创建了2个项目文件夹:

www/project1/ 
www/project2/

My virtual hosts file looks like this: 我的虚拟主机文件如下所示:

NameVirtualHost *:80

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

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

Can someone advise how I can go about doing this? 有人可以建议我该怎么做吗?

You need to specify ServerName in VirtualHost like this (and additionally ServerAlias) for each hostname: 您需要像这样(以及另外的ServerAlias)在VirtualHost中为每个主机名指定ServerName:

<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>

Here is a full tutorial, hope it helps. 这是完整的教程,希望对您有所帮助。 Let me know if you run into any problems. 如果您遇到任何问题,请告诉我。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM