Hi,

(This concerns apache2.0, i've no idea if the other versions are affected too.)

I've discovered something that the vhosting docs don't seem to cover.
If you want to use both mod_vhost_alias (VirtualDocumentRoot et al)
and normal name-based vhosts (VirtualHost), you need to do something
like the following. For a server host.example.com, with an ip address
of 192.0.2.1:

-------------------------------8<--------------------------
NameVirtualHost 192.0.2.1:80

<VirtualHost 192.0.2.1:80>
  ServerName somethingwhichdoesntexist.example.com
   VirtualDocumentRoot /srv/%1/public_html
</VirtualHost>

<VirtualHost 192.0.2.1:80>
   ServerName www.example.com
   ServerAlias example.com host.example.com
   DocumentRoot /var/www/
</VirtualHost>
------------------------------->8--------------------------

This is type of setup isn't covered in the vhost docs at all that i
can see. Where it gets tricky is the ServerName entry for the first
VirtualHost. Without it, here's what happens:

   http://www.example.com, http://example.com are served from
/var/www as expected
   http://blah.example.com is served from /srv/blah/public_html, also
as expected
   http://host.example.com is served from /srv/host/public_html,
_not_ as expected.

Without a ServerName entry for the first VirtualHost, apache will
assign one from the reverse dns lookup for the ip, which points to
host.example.com. Adding an explicit ServerName for a garbage hostname
works around this, giving the following:

   http://www.example.com, http://example.com,
http://host.example.com are served from /var/www as expected
   http://blah.example.com is served from /srv/blah/public_html, also
as expected

Steve
--
"You are technically correct, the best kind of correct."
- Bureaucrat 1.0, Futurama

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to