有一个奇怪的问题configurationApache。
我有4个域名
www.my,使用domain.tld
www.anotherdomain.tld
我为每个域configuration了命名的虚拟主机。
mydomain.tld,my-domain.tld和anotherdomain.tld正常工作,但另一个domain.tld工作不正常。
Apache似乎在为anotherdomain.tld提供虚拟主机,并为其提供服务,而不是another-domain.tld
都有正确的服务器名称设置
和
这似乎是唯一可能成为问题的地方。 有没有人有任何build议find这个错误的原因。
其他几个注意事项:每个虚拟主机在不同的文件。 mydomain.tld和my-domain.tld放在另一个ip地址到anotherdomain.tld和another-domain.tld。
你怎么知道Web服务器正在服务anotherdomain.tld而不是another-domain.tld? 你看到浏览器的地址栏中的URL是否有另一个domain.tld?
如果您使用复制粘贴技术创build了这些configuration,则可以让DocumentRoot在两个域中保持一致。
另一个猜测是,如果anotherdomain.tld和another-domain.tld被configuration在同一个apache的IP地址上,而另一个domain.tlp的DNS “A”logging被设置为一个不同的IP地址,Apache HTTPD只是提取默认的VirtualHost对于其configuration中指定的IP,可能是另一个domain.tld。
例如:如果你在DNS中:
anotherdomain.tld -> 1.2.3.12 another-domain.tld -> 1.2.3.12
然后在httpd.conf中:
<VirtualHost 1.2.3.12:80> ServerName anotherdomain.tld ... </VirtualHost <VirtualHost 1.2.3.18:80> ServerName another-domain.tld ... </VirtualHost
在浏览器的地址栏中inputhttp://another-domain.tld/时,会向1.2.3.12发出一个请求,为1.2.3.12 (这是anotherdomain.tld取出默认的虚拟主机。
这些只是两个野生的猜测,虽然…