httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Bowen <rbo...@rcbowen.com>
Subject Re: [users@httpd] mixing dynamic and static virtual host definitions
Date Mon, 25 Oct 2010 16:23:32 GMT

On Oct 25, 2010, at 12:07 PM, Matt Price wrote:

> 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,

You second vhost lacks a ServerName directive. As such, all traffic  
goes to the first (default) virtual host.

The solution is to put a ServerName (and possibly one or more  
ServerAlias directives) in the second VirtualHost.

--
Rich Bowen
rbowen@rcbowen.com
http://drbacchus.com/




Mime
View raw message