[Gllug] Apache V hosts
Luke Hopkins
streaklug at streaknet.co.uk
Tue Oct 7 11:51:13 UTC 2003
Well done that man. Thank you :-)
Luke
-----Original Message-----
From: gllug-bounces at linux.co.uk [mailto:gllug-bounces at linux.co.uk] On
Behalf Of Steve Nicholson
Sent: 07 October 2003 13:14
To: Greater London Linux Users Group
Subject: Re: [Gllug] Apache V hosts
On Tue, 2003-10-07 at 11:33, Luke Hopkins wrote:
> I need to add some apache vhosts who all read from the same directory
> (database connections are dependand on the subdomain).
>
> I currently have:
> <VirtualHost *>
> ServerAdmin luke at domain.com
> DocumentRoot /home/sites/home/web
> ServerName sub1.domain.com
> </VirtualHost>
> <VirtualHost *>
> ServerAdmin luke at domain.com
> DocumentRoot /home/sites/home/web
> ServerName sub2.domain.com
> </VirtualHost>
>
> <VirtualHost *>
> ServerAdmin luke at domain.com
> DocumentRoot /home/sites/home/web
> ServerName sub3.domain.com
> </VirtualHost>
>
> What happens when I browse to say sub3.domain.com is the servername
(php
> $SERVER_NAME) is sub1.domain.com because that's at the top of the
list.
> Any ideas how I get it to return the correct subdomain without having
to
> use different directories (and preferably avoiding rewrites)?
I've recently been playing with this and had same problems, make sure
you have
NameVirtualHost *
if this is a hostname or IP address and all the VirtualHost directives
are are * you won't get a match.
>From what I found you need to have matching NameVirtualHost IP's (or *)
and <VirtualHost IP's (or *)> directives.
e.g.
NameVirtualHost *
<VirtualHost *>
....
otherwise a match isn't found and it defaults to the first one in the
list.
Steve.
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list