httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chet Luther <chet.lut...@gmail.com>
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
<manigg@dunncenter.org> 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 gwshark.homelinux.com 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 sharkattack.homelinux.com>
> ServerAdmin webmaster@gwshark.homelinux.com
> DocumentRoot /var/www/gwshark
> ServerName   shark
> </VirtualHost>
>  
> <VirtualHost gwshark.homelinux.com>
> ServerAdmin webmaster@gwshark.homelinux.com
> DocumentRoot /var/www/html
> ServerName   default
> </VirtualHost> 
> =====

Gary,

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
Host: sharkattack.homelinux.com

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
chet.luther@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message