apache WAMP 本地主机上的多个域

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1516112/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:13:09  来源:igfitidea点击:

Multiple-domains on WAMP localhost

apachelocalhostsysadminwampmultiple-domains

提问by Chris

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?

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

回答by David Kurid?a

You need to specify ServerName in VirtualHost like this (and additionally ServerAlias) for each hostname:

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

<VirtualHost *:80>
    ServerAdmin [email protected]
    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 [email protected]
    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>

回答by Maurice

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/