Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.