httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Price <>
Subject Re: [users@httpd] mixing dynamic and static virtual host definitions
Date Mon, 25 Oct 2010 16:07:38 GMT
  On 10-10-25 11:21 AM, Eric Covener wrote:
>> then it pre-empts everything (not what I expected, since I'm using
>> ServerName, which I thought limited the application of this stanza to
>> instances in which HTTP_HOST matches. ServerName.
> Whichever one you put first is the default, which is used when there's
> no matching ServerName/ServerAlias.  The one where you left off
> ServerName/ServerAlias is only the default because it's first, not
> because it's not "constrained" to specific ServerNames -- it's
> actually unusuably when it's not first since it matches no server
> names.
ok, I'm trying to understand but I guess I don't quite get it.  If I 
have a file like this:

<VirtualHost *:80>                                                                 

     DocumentRoot /home/drupal-commons/drupal_commons




<VirtualHost *:80>                                                                 

     UseCanonicalName    Off

     VirtualDocumentRoot /var/www/%0

     Options All


     # Store uploads in /var/www/wp-uploads/$0

     RewriteEngine On

     RewriteRule ^/wp-uploads/(.*)$ /var/www/wp-uploads/%{HTTP_HOST}/$1


all traffic, no matter the HOST of the request, gets directed to 
/home/drupal-commons/drupal_commons.  If I reverse the stanzas, no 
traffic ever gets directed there.  Is there no possible ordering in 
which some traffic is matched by one of the stanzas, and some by 
another?  And if not, is there a better trick to make that work?  Thanks 
very much,


ps -- Not sure but I may have solved this by adding a

ServerName *

to the dynamic VirtualHost stanza.  Is that bad practice?  And may I ask 
what I should do to capture requests that come in without a HOST: header 
(that is, in which the request is made directly by IP)?  I'd like to 
send those somewhere -- right now they go straight to, which I'd rather not have happen.  Thanks again 
very much,

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