问题原文
原帖链接 · Buckket5 · CC BY-SA 3.0
I can't find anywhere which states if I can set a default virtual host config. I know you have 000-default.conf which is used when no vHost is found, but what about if I want to set a default config on all directories within /var/www?
Say if I want to use this "default" global virtual host file to set Options -Indexes, I would then want Apache to set this on any directory in /var/www unless stated otherwise by the virtual host of the domain name.
Is this something that is possible, if so could you show me how?
已采纳解答
原帖链接 · Daniel Ferradal · CC BY-SA 3.0
If you want to set a default configuration for /var/www directory that applies to any virtualhost you define unless it was manually defined somewhere else, then you have to define this directory configuration in the previous hierarchical context to Virtualhost, that is, server config (global configuration).
For instance, if you don't want Indexes enabled by default for the documentroot path in /var/www, and your main configuration file is httpd.conf or apache2.conf, there you just have to add:
<Directory /var/www>
Options -Indexes
#any other config here
</Directory>
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
