httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Verbeeck <>
Subject [users@httpd] Incorrect VirtualHost mapping
Date Fri, 06 Feb 2004 08:51:15 GMT

I've got a problem with a certain virtual host setup using Apache 2.
I have two virtual hosts defined in my Apache config, both on the
same IP address.  The first has the actual DNS name of the machine
as the ServerName.  The second one, has the IP address of the
machine as the ServerName.  Like so:


        ServerName mydns
        DocumentRoot /home/httpd/htdocs/DNS/

        DocumentRoot /home/httpd/htdocs/IP/

Now, when I perform a request http://mydns:8000/index.html, I get
teh correct page from /home/httpd/htdocs/DNS/.  But when I request then I get the same page, instead
of the one from /home/httpd/htdocs/IP/.

I understand that this happens if there is no Host header present
(the first matching virtual host is used).  But in my tests the
host header was present.

If I reverse the order of the virtual hosts in the configuration
file, then everything works as expected (because then the first
virtual host is the one with the IP address as ServerName).  But
this is not an option for my setup, because the list of virtual
hosts is generated and the order of the virtual hosts is undefined
and might change from one time at another.

Is there some way that I can configure Apache to also accept IP
address as ServerName and then to correctly map the request to a
virtual host?

ir. Kris Verbeeck
Software Engineer

Ubizen - Ubicenter - Philipssite 5 - 3001 Leuven - Belgium
T:  +32 16 28 70 64
F:  +32 16 28 70 77

Ubizen - We Secure e-business -

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message