Gentoo Archives: gentoo-server

From: "Michael Stewart (vericgar)" <vericgar@g.o>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] apache config question
Date: Thu, 05 Oct 2006 02:17:23
Message-Id: 45246A5C.9000207@gentoo.org
In Reply to: [gentoo-server] apache config question by Ben Munat
1 Ben Munat wrote:
2 > Hello. Does anyone know how I can configure apache 2.0.x to map all
3 > requests to a given subdomain to a give directory regardless of the rest
4 > of the server name?
5 >
6 > Doing this for my webmail setup... so mail.foo.com, mail.bar.com,
7 > mail.baz.com, etc. should all map to my squirrelmail directory.
8 >
9 > I've been doing this by adding virtual host directives for the mail
10 > subdomain for every domain I add but it seems like there should be an
11 > easier way. I figure I can probably do it with mod_rewrite but I'm no
12 > wizard with that.
13 >
14 > thanks,
15 >
16 > b
17
18 If I understand you right, you want mail.* to point to say /var/www/mail
19 , while letting other domains/subdomains point to their own places.
20
21 Here's how I handle it on my server:
22
23 <VirtualHost *:80>
24 ServerName mail.your-domain.com
25 ServerAlias mail.*
26 DocumentRoot /var/www/mail
27 [... other configuration as needed ...]
28 </VirtualHost>
29
30 This needs to be one of the first virtual hosts that apache reads so
31 that it matches mail.* before it matches say *.blahblah.com (if you are
32 hosting blahblah.com)
33
34 --
35 Michael Stewart vericgar@g.o
36 Gentoo Developer http://dev.gentoo.org/~vericgar
37
38 GnuPG Key ID 0x08614788 available on http://pgp.mit.edu
39 --

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-server] apache config question Ben Munat <bent@×××××.com>