[Gllug] mod_vhost_alias

Paul paul at rbg.uklinux.net
Wed Nov 27 19:54:09 UTC 2002


On Tue, 2002-11-26 at 14:09, The Flying Hamster wrote:
> On Tue, Nov 26, 2002 at 09:59:26AM +0000, Jason Clifford wrote:
> > On 25 Nov 2002, Paul wrote:
> > 
> > > Is it possible in Apache to have most virtual hosts dealt with by
> > > mod_vhost_alias, but override this for some special virtual hosts. e.g.
> > > to get separate logfiles etc?
> > > 
> > > I've tried putting the <VirtualHost ... > section first for a special
> > > hostname and then the general VirtualDocumentRoot directive later but
> > > this doesn't seem to work - it all went through the mod_vhost_alias
> > > route.
> > 
> > I always use a separate instance of httpd for mod_vhost_alias services and 
> > have those which require specific configuration running on a separate IP.
> > If you list the <VirtualHost...> instances before you list the 
> > mod_vhost_alias ones it may work but I've not actually tried it.
> 
> If there's a VirtualHost block for a given site then the directives in
> there will come into effect, but only after a server reload.  We use
> it to get customers up and running instantly but at the expense of
> logging not kicking properly until the midnight reload.

OK I think I've got this working now.

The thing I didn't do at first was put the VirtualDocumentRoot line inside a <VirtualHost> 
container but having done this it seems to work. Because if you're using 
VirtualDocumentRoot on its own you don't need it enclosed.

So my relevant test setup is:

UseCanonicalName Off
NameVirtualHost 127.0.0.1:80

<VirtualHost *>
 DocumentRoot /var/www/foo/htdocs
 ServerName foo.com
</VirtualHost>

<VirtualHost *>
 VirtualDocumentRoot /var/www/%0
</VirtualHost>

then with foo.com and bar.com set up to resolve to 127.0.0.1 in /etc/resolv.conf
it serves foo.com using the first VirtualHost section and bar.com using the second 
(mod_vhost_alias) VirtualHost section.

Paul.


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list