Re: Order of applicatoin of sites-enabled configs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 www.mattbusche.org) and the second (my default) has no ServerName entry, but uses a "ServerAlias *" to match everything else and includes a Redirect www.mattbusche.org to send all requests through such non-standard names back to the official name for my website, www.mattbusche.org.  In that way requests to both mattbusche.org and 75.70.80.142 get directed back to www.mattbusche.org.  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:

100-www.mattbusche.org.conf:

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


999-default.conf:

<VirtualHost *:80>
    ServerAlias *
    Redirect permanent / http://www.mattbusche.org/
</VirtualHost>


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.


Thanks,
Matt




On Wednesday, August 6, 2014 5:08 AM, Eric Covener <covener@xxxxxxxxx> wrote:
On Wed, Aug 6, 2014 at 5:20 AM, M Busche <spammymatt94@xxxxxxxxx.invalid> 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:
http://httpd.apache.org/docs/2.2/mod/core.html#include 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx






[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux