httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Price <matt.pr...@utoronto.ca>
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

     ServerName tdhc.digitalcommons.ca

</VirtualHost>                                                                     
                                                         

                                                                                         
                                                   

<VirtualHost *:80>                                                                 
                                                         

     UseCanonicalName    Off

     VirtualDocumentRoot /var/www/%0

     Options All

     ServerAdmin matt.price@utoronto.ca

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

     RewriteEngine On

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

</VirtualHost>

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,

Matt

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 
tdhc.digitalcommons.ca, which I'd rather not have happen.  Thanks again 
very much,
Matt




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message