I'm managing a httpd installation with several sites running on it, each defined within it's own <VirtualHost>
directive. There are several configuration variables (most of them from core as well as some php_flag
/php_value
) that are exactly the same for several of the sites defined.
I would like to be able to define a configuration set that will apply to several <VirtualHost>
directives at the same time (to remove redundancy and make the server maintenance a little bit easier).
I have considered using <Directory>
, however many of the configuration values I need to set, cannot be modified from within <Directory>
. I have also tried to define another <VirtualHost>
section, containing all of the sites I want to share the config in
<VirtualHost xx.xx.xx.xx:80 yy.yy.yy.yy:80>
...config...
</VirtualHost>
but this just results in
VirtualHost xx.xx.xx.xx:80 overlaps with VirtualHost yy.yy.yy.yy:80, the first has precedence, perhaps you need a NameVirtualHost directive
Any idea how I can achieve this?
In apache documentation this is called mass VirtualHost configuration.
Several solutions exists:
VirtualDocumentRoot
instructions, but it is usually too simple and managing other variations thanDocumentRoot
and the domain name are quite hard.DocumentRoot
andServerName
and share single configurations files between serval Vhosts.