Apache 中的虚拟主机根据 HTTP 主机进行操作?
我目前的设置是:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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