httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: [users@httpd] how do I *define* a default virtual host
Date Tue, 15 Sep 2009 10:46:09 GMT
Krist van Besien wrote:
> On Tue, Sep 15, 2009 at 9:02 AM, robert rottermann <> wrote:
>> hi ther,
>> I load my VH's from a directory with a number of VH's
>> is it possible to define which one is the default one?
>> it seems to select the first in alphabetical order.
> I asume you have one config that pulls in the VH's configs via an
> include statement. Something like:
> Include /etc/httpd/vhosts/*.conf
> In that case they are indeed loaded in alphabetical order, as that is
> the way the OS sorts files by default.
> You can influence that by just having a file named:
> 000_default.conf
> in that directory, which will always get loaded first. Put your
> default vhost in that file...
Or, let's say you want to be really sophisticated, and show that you 
know how these things work, even the ones not really explained in the 
In that case, you could name your default VHost definition file as 
".default-site.conf" (and whatever you want for the others, as long as 
their name does not start with ".").
Then you would use this in your main configuration file :

Include /etc/httpd/vhosts/.default-site.conf
Include /etc/httpd/vhosts/[^.]*.conf

The first line will pull in the default VHost first, which is what you 
absolutely want, for it to be the default VHost.
Then the second line will pull in all the others, for which you don't 
care anymore about the order.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message