httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Busche <>
Subject Re: [users@httpd] Order of applicatoin of sites-enabled configs
Date Wed, 06 Aug 2014 15:58:42 GMT
Ooops!  Somehow I missed the "in alphabetical order" the first time I read that.  Thanks
for making me read that again!

After playing with this last night, it looks to me like Apache stops as soon as it finds a
virtual host with a matching ServerName (or ServerAlias).  In my case I have two VirtualHosts
the first for my official website name (ServerName and the second (my
default) has no ServerName entry, but uses a "ServerAlias *" to match everything else and
includes a Redirect to send all requests through such non-standard names
back to the official name for my website,  In that way requests to both and get directed back to  But to get it to
work, I had to rename the default config so it was named alphabetically AFTER my main config. 
For this reason I find the choice of numbering the default config with 000 strange, since
you can't number anything before that, but (at least in my case and I would presume in most
cases) you want a default to be chosen last. 
 I was getting an infinite redirect until I renamed the default configuration 999-default.conf.

Here are my actual working conf files:

<VirtualHost *:80>
    ServerAdmin [my email address]
    DocumentRoot /var/www
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


<VirtualHost *:80>
    ServerAlias *
    Redirect permanent /

This is what worked for me.  Am I missing something?  Or am I using the system in dark and
twisted ways that would make good church-going apache experts faint?

BTW, I haven't made this change on my live server yet -- this is all on my test environment
-- so don't be befuddled if you don't see my live machine redirecting as I claim here.


On Wednesday, August 6, 2014 5:08 AM, Eric Covener <> wrote:
On Wed, Aug 6, 2014 at 5:20 AM, M Busche <> wrote:

> Hi,
> I notice that the default virtual host configuration file name is 000-default.conf. 
I presume the convention of starting virtual host configuration file names with a three digit
number governs the order in which the configurations are applied.  Can someone point me to
the apache docs web page that explains this?

This is a layout determined by whoever packaged your server and
created your default configuration. Check out their README.  It just
boils down to the Include directive: 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message