我在apache(CentOS)中设置了几个vhost,在外部文件conf.d / vhost.conf
中他们都有这样的配置:
<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>
之间的部分相同。应该可以为每个vhost使用默认目录配置吗?我无法找到/弄清楚如何做到这一点?
答案 0 :(得分: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>