2012-11-27 175 views
0

我有一個網站的Web服務器,我想添加另一個地址用於預生產使用。嘗試添加虛擬主機

這裏existant:

的httpd.conf:

ServerAdmin [email protected] 
ServerName www.toto.com:80 
DocumentRoot "/home/tutu/var/www/html" 

模塊/ vhost.conf:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName www.toto.com:80 
    DirectoryIndex index.php 

    ErrorLog /home/tutu/var/log/httpd/error-mod_log 
    LogLevel warn 
    CustomLog /home/tutu/var/log/httpd/access-mod_log common-cookie 

    <Location /server-status> 
    SetHandler server-status 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.1 
    </Location> 
</VirtualHost> 

我試圖添加其他虛擬主機,但不工作的新地址:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName www2.toto.com:80 
    DirectoryIndex index.php 

    ErrorLog /home/tutu/var/log/httpd/error-www2_log 
    LogLevel warn 
    CustomLog /home/tutu/var/log/httpd/access-www2_log common-cookie 
    DocumentRoot "/home/tutu/var/www2/html" 
</VirtualHost> 

地址www2.toto.com不起作用。 你有想法嗎?

謝謝

回答

3

您是否已將www2.toto.com添加到DNS? 尚未添加到公共DNS中。 (但www.toto.com是)

「不工作」不是很具體。你有沒有得到該網站的默認Apache網頁,或者你沒有到達服務器?如果是後者,DNS查找可能是您真正的問題,而不是Apache配置。

Apache-config看起來不錯,但你不需要指定:80作爲別名端口。

+0

對不起,我沒有到達服務器。 – superscral

+0

這是DNS方面,是的,謝謝 – superscral