Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to think of an apache configuration based on the one from the docs where each virtualhost is essentially the same, but I wan't to add an include directive pointing to a config file to differentiate each one, allowing differences in config, without using an htaccess file.

# get the server name from the Host: header
UseCanonicalName Off

# this log format can be split per-virtual-host based on the first field
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /www/hosts/%0/docs
VirtualScriptAlias /www/hosts/%0/cgi-bin

But I don't suppose I can add Include /www/hosts/conf/%0.conf or something similar?

Is there any standard way of doing this?

share|improve this question
up vote 0 down vote accepted

Include one file in which you can, if needed, define Virtualhost container for every modified from default settings virthost. It's not standard, but widely used practice.

I use it and find more easy to maintain 1 file than (rather) long set

share|improve this answer
Sounds good. Does each VirtualHost container you specify in that file inherit from the default, or would you have to specify the DocumentRoot, ServerName, etc.. again? – Adam Nov 5 '11 at 12:50
I write all explicitly, can't recall reasons for "why" and add additional definitions – Lazy Badger Nov 5 '11 at 13:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.