2014-02-25 150 views
0

我在apache的虛擬主機的幾個設置(CentOS的),在外部文件conf.d/vhost.conf共享目錄配置翻過apache的虛擬主機

他們都有一個配置,如下所示:

<VirtualHost *:80> 
    ServerName www.example.com 
    DocumentRoot "/app/example_site/public"    
    <Directory "/app/example_site/public"> 
     Options FollowSymLinks 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

在例如在此conf文件中定義的20個虛擬主機,以及<Directory "xxxx"> </Directory>之間的部分對於每個虛擬主機都是相同的。應該可以爲每個虛擬主機使用默認目錄配置嗎?我無法找到/弄清楚如何做到這一點?

回答

0

剛剛傾倒的共同信息到一個文件中,並使用Include directive加載它:

<VirtualHost *:80> 
    ServerName www.example.com 
    DocumentRoot "/app/example_site/public"    
    <Directory "/app/example_site/public"> 
     Include "/path/to/common_dir_config.conf" 
    </Directory> 
</VirtualHost>