[ILUG] Re: apache mod_vhost_alias and normal vhosts
Stephen Shirley
diamond at skynet.ie
Tue Aug 29 22:35:17 IST 2006
*sigh* I've found the problem, and have a solution. It's not pretty.
What happens is this (despite the fact that it makes no sense to do so
because we're using mod_vhost_alias): Because there is no ServerName
entry in the first <VirtualHost>, apache will do a reverse dns lookup
on the ip supplied, and use that instead. As that ip resolves to
'ja.ichbinn.net', the first vhost will _always_ match it.
With that in mind, the solution is this: add a bogus ServerName entry
to the <VirtualHost>. Apache doesn't seem to care if it resolves or
not, so i've gone with the following (repeating the whole config again
for clarity):
-------------------------------8<--------------------------
NameVirtualHost 213.239.204.216:80
<VirtualHost 213.239.204.216:80>
ServerName somethingwhichdoesntexist.ichbinn.net
VirtualDocumentRoot /srv/%1/public_html
</VirtualHost>
<VirtualHost 213.239.204.216:80>
ServerName www.ichbinn.net
ServerAlias ichbinn.net ja.ichbinn.net
DocumentRoot /var/www/
</VirtualHost>
------------------------------->8--------------------------
Et voila, though ugly, it works. Thanks to madduck for pointing out
what was going wrong.
Steve
--
"You are technically correct, the best kind of correct."
- Bureaucrat 1.0, Futurama
More information about the ILUG
mailing list