2012-09-06 77 views
3

我有Apache服務器上運行example.comtest.example.com域。出於某種原因,當我試圖訪問test.example被重定向到www.test.example和結果將顯示在瀏覽器中Server not found錯誤。 .htaccess(根和子域文件夾)文件都是空的。子域redict到www

更多的事實

我還有一個子域xyz.example.com指出到public_html一些裏面的內容/ XYZ目錄(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 [email protected] 
    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> 

感謝您的時間

回答

0

在綁定的配置區域,你不設置子域測試 在example.com區域中加入這一行>>

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

xxx.xxx.xxx.xxx爲您的服務器的IP地址

或者您不啓用虛擬主機配置>>

a2ensite test.example.com 

test.example.com是虛擬主機文件的名稱。

+0

我檢查了第一個選項,它是正確的。那麼,如何啓用(如果不是)虛擬主機? – manix