我已经阅读了https-vhosts.conf文件中的Apache文档,经过几个小时处理这个问题,我自己就想出了这个问题。 情况如下:
我们有一个以.ws结尾的域名
显然你不能在conf文件中这样做。 你必须使用? 通配符,否则将无法工作。 *通配符也不起作用。 此外,在ServerAlias指令中,如果ServerAlias指令中的第一个条目不正确,则超过第一个条目的任何内容都将不起作用。
这是一个不起作用的例子。 请注意,anotherdomain.com和yetanotherdomain.com将失败,因为domain.wsconfiguration不正确:
<VirtualHost *:80> DocumentRoot /opt/local/apache2/sites/ourdomain ServerName www.thedomain.ws ServerAlias thedomain.ws another domain.com yetanotherdomain.com <Directory /opt/local/apache2/sites/ourdomain> allow from all </Directory> </VirtualHost>
这是我们工作条目的一个例子:
<VirtualHost *:80> DocumentRoot /opt/local/apache2/sites/ourdomain ServerName www.thedomain.ws? ServerAlias thedomain.ws? another domain.com yetanotherdomain.com <Directory /opt/local/apache2/sites/ourdomain> allow from all </Directory> </VirtualHost>
如果有这方面的文件,我当然没有看到它。
?
根本不是一个通配符,据我所知 – 不是在ServerAlias
,并且绝对不在ServerName
,它不支持任何types的通配符。
在testing系统上,我看到了我期望的行为 – ServerName test.ws
工作得很好, ServerName test.ws?
从不将请求映射到该虚拟主机。
我希望你看到一些其他的问题 – 当你有无效的.ws?
那里的名字实际上正确地提供了请求。 请提供来自apachectl -S
的输出以及来自该输出的任何相关的虚拟主机configuration。