httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From M Busche <spammymat...@yahoo.com.INVALID>
Subject Re: [users@httpd] Order of applicatoin of sites-enabled configs
Date Thu, 07 Aug 2014 21:16:52 GMT
Frank,

I don't think you understood what I was trying to say.  My complaint was that in the pre-packaged
configuration made with the ubuntu distribution, the default vhost configuration is placed
in a file prefixed with the string 000 which causes it to be loaded first.  I renamed it
to have a prefix 999, so that it was loaded (and processed) last.  I think we are in complete
agreement.  My original query was to find out whether there was something I was confused
about, or alternatively an explanation as to why-on-earth the people who put together the
ubuntu distribution would set things up that way.

Matt



On Thursday, August 7, 2014 3:40 AM, Francois Gingras <francois.gingras@gmail.com> wrote:
 



Bad idea. Use the default vhost behaviour to define what vhost will
    be used for unknown hostnames not matching any ServerName /
    ServerAlias directive. The default *:80 vhost must be defined first.

You can even use ServerName <ip> or ServerName <random
    hostname> in the default vhost.

Frank




On Wed, Aug 6, 2014 at 11:58 AM, M Busche <spammymatt94@yahoo.com.invalid> wrote:

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@gmail.com> wrote:
>On Wed, Aug 6, 2014 at 5:20 AM, M Busche <spammymatt94@yahoo.com.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@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
Mime
View raw message