3

我有域example.comtest.example.com在 apache 服务器上运行。出于某种原因,当我尝试访问test.example时,它​​被重定向到www.test.example并因此Server not found在浏览器中显示错误。.htaccess(根和子域文件夹)文件都是空的。

其他事实

我有另一个子域xyz.example.com指向 public_html/xyz 目录,其中包含一些内容(带有“hello world 消息”的 index.html),如果我使用 xyz.example.com 而不是 www.xyz.example.com,它可以正常工作。所以,你能帮我指出正确的方向吗?我有一个 vps,如果需要,我可以更改任何文件。

您可以在下面找到我的虚拟主机配置。

<VirtualHost xx.xxx.xxx:80>
    ServerName test.example.com
    ServerAlias www.test.example.com
    DocumentRoot /home/example/public_html/test
    ServerAdmin webmaster@test.example.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/test.example.com combined
    CustomLog /usr/local/apache/domlogs/test.example.com-bytes_log "%{%s}t %I  .\n%{%s}t %O ."

    ScriptAlias /cgi-bin/ /home/example/public_html/test/cgi-bin/

    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/example/test.example.com/*.conf"

</VirtualHost>

谢谢你的时间

4

1 回答 1

0

在绑定配置区域中,您没有设置子域测试在 example.com 区域中添加此行 >>

test.example.com         IN        A         (xxx.xxx.xxx.xxx)

xxx.xxx.xxx.xxx 是你服务器的 ip

或者你不启用你的虚拟主机配置>>

a2ensite test.example.com 

test.example.com 是虚拟主机文件的名称。

于 2012-09-06T09:29:49.563 回答