Apache 中的虚拟主机根据 HTTP 主机进行操作?

发布于 2024-12-25 02:15:30 字数 350 浏览 2 评论 0原文

我目前的设置是:

xx.domain.com (CNAME)-> user.dyndns.org ->我的 IP

目前,我在 Apache 中设置了虚拟主机,以便 xx.domain.com 指向一个目录,而 xx.domain.com:8080 指向另一个目录。

然而,我想要完成的不是通过端口进行区分,而是希望能够让 xx.domain.com 和 zz.domain.com 指向不同的目录。

这是如何实现的? ServerAlias 和 ServerName 似乎不起作用,因为我怀疑 user.dyndns.org 实际上是 ServerName。虽然我的猜测可能是错误的。

谢谢。

I currently have this set up:

xx.domain.com (CNAME)-> user.dyndns.org -> MY IP

Currently I have virtual hosts setup in Apache so that xx.domain.com points to one directory, and xx.domain.com:8080 points to another.

However what I'm trying to accomplish is rather than differentiating by ports, I want to be able to have xx.domain.com and zz.domain.com point to different directories.

How is this accomplished? ServerAlias and ServerName don't seem to work because I suspect that user.dyndns.org is actually the ServerName. Though my guess may be incorrect.

Thanks.

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

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

发布评论

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

评论(1

轮廓§ 2025-01-01 02:15:30

ServerName 应该适合你。 HTTP 请求应该进入您的服务器并通过 CNAME 指向主机,而不是 user.dyndns.org ——所以您应该没问题。也许你的问题是端口问题,当你测试它时,你是否也将 zz.domain.com 设置为监听 80?

http://httpd.apache.org/docs/2.0/vhosts/examples.html

ServerName should work for you. The HTTP Requests should be coming into your server pointing to the host by the CNAME, not user.dyndns.org -- so you should be OK. Perhaps yours was a port issue when you tested it did you set zz.domain.com to listen on 80 as well?

http://httpd.apache.org/docs/2.0/vhosts/examples.html

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