2013-10-16 29 views
0

我們正在嘗試爲服務器上配置的域設置分段服務。用於分段的Apache虛擬域

目前我們在DNS中有以下內容,它正確地指向我們的服務器。

*.server001.stage.ourdomain.com.au 

這有助於位於默認站點:

/Server/http/_default 

我想它做的是通過加載到位通配符的信息基於一個網站。 示例;

test.com.server001.stage.ourdomain.com.au 

將返回的內容:我們可能會使用.com.au域名太

/Server/http/test.com 

記憶,所以「server001」部分之前有好多是什麼要求。

回答

0

您應該爲test.com.server001.stage.ourdomain.com.au定義另一個<VirtualHost>塊,其DocumentRoot指向/Server/http/test.com

像這樣的事情

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /Server/http/test.com 
    ServerName test.com.server001.stage.ourdomain.com.au 
    ErrorLog /var/logs/httpd/test.com/error_log 
    CustomLog /var/logs/httpd/test.com/access_log common 
</VirtualHost> 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /Server/http/_default 
    ServerName *.server001.stage.ourdomain.com.au 
    ErrorLog /var/logs/httpd/server001.stage.ourdomain.com.au/error_log 
    CustomLog /var/logs/httpd/server001.stage.ourdomain.com.au/access_log common 
</VirtualHost> 

通配符VirtualHost應該是因爲apache拿起第一個匹配的VirtualHost最後一個。

+0

感謝您的回答,但我們希望動態執行此操作,因此無需對任何配置進行更改。 – ajdi