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 <spammymat...@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 <cove...@gmail.com>
> wrote:
> On Wed, Aug 6, 2014 at 5:20 AM, M Busche <spammymat...@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-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>

Reply via email to