WAMP 本地主机上的多个域

发布于 2024-08-06 20:11:14 字数 471 浏览 11 评论 0原文

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

我正在 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>

有人可以建议我如何执行此操作吗?

If you're reading my question, thanks, I appreciate your help

I'm using Wamp on Windows Vista.

I've created 2 project folders:

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

为你拒绝所有暧昧 2024-08-13 20:11:14

您需要在 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>

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

<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>
长梦不多时 2024-08-13 20:11:14

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

http://kintek.com.au/博客/在 wamp 内配置多个域以进行本地开发/

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文