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

Apache 1.3 mod_vhost_alias, ServerAlias and logging



Hi,

I'm setting up a new server and would like to use mod_vhost_alias, or other 
mass virtual hosting method, if possible.  mod_vhost_alias is very simple to 
setup and works as advertised:

    LoadModule vhost_alias_module /usr/lib/apache/1.3/mod_vhost_alias.so
    UseCanonicalName Off
    VirtualDocumentRoot /var/www/%0/web

Unfortunately, it is as simple as it is simple to setup ;-)  My question is in 
regards to ServerAlias.  "Normal" clients host their website at 
http://www.abcd.com/ but they (and I) also like it when http://abcd.com/ 
works as well.  Is there any way (besides filesystem link) to make 
vhost_alias find the right DocumentRoot?

Ideally I'd like a directory structure like this:

    /var/www/com/abcd/web/
    /var/www/com/abcd/subdomain/web/

When serving http://www.abcd.com/ apache wouldn't 
find /var/www/com/abcd/www/web/ so it would fallback 
to /var/www/com/abcd/web/, if that were missing it would fallback 
to /var/www/com/web/ and then to /var/www/web/

Perhaps something like the above is possible using mod_rewrite???  I'll keep 
plugging away for a while but if anyone knows the answer I'm all for 
shortcuts.

Second question.  Supposing that the above can work somehow I'd like to use 
one common logfile for all virtualhosts, with the virtualhost's name 
prepended to each log line.  This is easy of course.  The catch of course is 
that I'd like to have consistent names for hosts, i.e. I don't want to be 
splitting off logfiles for www.abcd.com and abcd.com when those are actually 
the same site.

Basically, I'd like apache logging to be smart enough to realize that it is 
actually serving abcd.com although the hostname in the request was 
www.abcd.com.

-- 
Fraser Campbell <fraser@wehave.net>                 http://www.wehave.net/
Georgetown, Ontario, Canada                               Debian GNU/Linux



Reply to: