首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache配置-具有Hyphen的域

Apache配置-具有Hyphen的域
EN

Server Fault用户
提问于 2009-09-16 08:06:31
回答 1查看 1.8K关注 0票数 0

配置apache有一个奇怪的问题。

我有4个域

  • www.mydomain.tld
  • www.my-domain.tld
  • www.anotherdomain.tld
  • www.another-domain.tld

我已经为每个域配置了虚拟主机。

mydomain.tld、my-domain.tld和anotherdomain.tld工作正常,但另一个-domain.tld不能正常工作。

Apache似乎正在为anotherdomain.tld选择虚拟主机,并为其服务,而不是另一个-domain.tld。

两个服务器名称都已正确设置。

  • ServerName anotherdomain.tld

  • ServerName另一个-domain.tld

这似乎是唯一可能成为问题的地方。有没有人对找出这一错误的原因有任何建议。

还有几个注意事项:每个虚拟主机都位于不同的文件中。mydomain.tld和my-domain.tld位于anotherdomain.tld和另一个-domain.tld的不同ip地址上。

EN

回答 1

Server Fault用户

发布于 2009-09-17 07:02:54

您如何知道web服务器正在服务于anotherdomain.tld而不是另一个-domain.tld?您看到浏览器地址栏中的URL中有anotherdomain.tld吗?

如果您使用复制粘贴技术创建了这些配置,那么您可以为两个域保留相同的DocumentRoot。

另一种猜测是,如果anotherdomain.tld和另一个-domain.tld配置在相同的apache IP地址上,但是另一个-domain.tlpdns "A“记录被设置为不同的IP,则Apache只是提取其配置中指定的IP的默认VirtualHost,可能是anotherdomain.tld。

示例:如果在DNS中有:

代码语言:javascript
复制
 anotherdomain.tld ->  1.2.3.12
 another-domain.tld -> 1.2.3.12

然后在httpd.conf中:

代码语言:javascript
复制
<VirtualHost 1.2.3.12:80>
 ServerName anotherdomain.tld
  ...
</VirtualHost

<VirtualHost 1.2.3.18:80>
 ServerName another-domain.tld
  ...
</VirtualHost

当您在浏览器的地址栏中输入http://another-domain.tld/时,它会向1.2.3.12发出请求,该请求提取1.2.3.12的默认虚拟主机,即anotherdomain.tld

不过这只是两个疯狂的猜测..。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/65818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档