Re: mixing dynamic and static virtual host definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx

   # 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.




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux