httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chet Luther <>
Subject Re: [users@httpd] http.conf file problem
Date Thu, 23 Sep 2004 02:16:00 GMT
On Wed, 22 Sep 2004 14:51:51 -0500, Gary Manigault
<> wrote:
> Apache problem.  I have the following virtual servers setup on my box.  Each of the virtual
servers document roots point to different directories with different index.html files in them.
 When I go to either address I get the page that is defined in the documentroot
directory.  That is not the way it is supposed to work from what I have read.  Is there any
way to correct it to pull the appropriate index file for each?  If so how? 
> ===== 
> <VirtualHost>
> ServerAdmin
> DocumentRoot /var/www/gwshark
> ServerName   shark
> </VirtualHost>
> <VirtualHost>
> ServerAdmin
> DocumentRoot /var/www/html
> ServerName   default
> </VirtualHost> 
> =====


I think your problem is a simple misunderstanding of the difference
between the name in the <VirtualHost NAME> directive, and the
ServerName NAME directive.

In <VirtualHost NAME>, NAME is simply a reference to the IP address
that the incoming request will be coming in on.. it relates directly
to the Listen x.x.x.x:x directive.  You have this setup properly.

The ServerName NAME is the important one, this is how Apache decides
to actually invoke the VirtualHost section.

When an HTTP/1.1 request comes into your server, it'll look something like this:

GET /index.html HTTP/1.1

The "Host" section is what the VirtualHost relies on.  To make a long
story short, change your ServerName directives to match what you have
up on the VirtualHost line.  I just wanted to be sure you understood
why you were doing it because this confused me quite a bit when I was
first setting up name-based virtual hosting.

Chet Luther

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