* [gentoo-server] apache config question
@ 2006-10-03 7:21 Ben Munat
2006-10-03 7:32 ` Javier Barrio
2006-10-05 2:13 ` Michael Stewart (vericgar)
0 siblings, 2 replies; 12+ messages in thread
From: Ben Munat @ 2006-10-03 7:21 UTC (permalink / raw
To: gentoo-server
Hello. Does anyone know how I can configure apache 2.0.x to map all
requests to a given subdomain to a give directory regardless of the rest
of the server name?
Doing this for my webmail setup... so mail.foo.com, mail.bar.com,
mail.baz.com, etc. should all map to my squirrelmail directory.
I've been doing this by adding virtual host directives for the mail
subdomain for every domain I add but it seems like there should be an
easier way. I figure I can probably do it with mod_rewrite but I'm no
wizard with that.
thanks,
b
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 7:21 [gentoo-server] apache config question Ben Munat
@ 2006-10-03 7:32 ` Javier Barrio
2006-10-03 8:24 ` Hans-Christian Otto
[not found] ` <45221D54.8060906@munat.com>
2006-10-05 2:13 ` Michael Stewart (vericgar)
1 sibling, 2 replies; 12+ messages in thread
From: Javier Barrio @ 2006-10-03 7:32 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
El Mon, 02 Oct 2006 21:21:55 -1000
Ben Munat <bent@munat.com> dijo:
> Hello. Does anyone know how I can configure apache 2.0.x to map all
> requests to a given subdomain to a give directory regardless of the
> rest of the server name?
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
ServerAlias webmail.domain.com
ServerAlias ...
ServerAdmin ...
DocumentRoot "..."
...
</VirtualHost>
The same applies for SSL ports.
No mod_rewrite needed for that.
--
echo "dpefsAgmv{p/psh" | perl -pe 's/(.)/chr(ord($1)-1)/ge'
GnuPG key ID 0x6D2FF8B5 @ pgp.rediris.es
Gentoo Linux on IA32|sparc64
http://fluzo.org/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 7:32 ` Javier Barrio
@ 2006-10-03 8:24 ` Hans-Christian Otto
2006-10-03 8:56 ` Ben Munat
[not found] ` <45221D54.8060906@munat.com>
1 sibling, 1 reply; 12+ messages in thread
From: Hans-Christian Otto @ 2006-10-03 8:24 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
> <VirtualHost *:80>
> ServerName domain.com
> ServerAlias www.domain.com
> ServerAlias webmail.domain.com
> ServerAlias ...
> ServerAdmin ...
> DocumentRoot "..."
> ...
> </VirtualHost>
>
> The same applies for SSL ports.
>
> No mod_rewrite needed for that.
Guess he meant that this should happen automatically and he does'nt want to
add the subdomain to every domain... Would be nice to know for me, too.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
[not found] ` <45221D54.8060906@munat.com>
@ 2006-10-03 8:47 ` Javier Barrio
2006-10-03 13:47 ` Ben Munat
0 siblings, 1 reply; 12+ messages in thread
From: Javier Barrio @ 2006-10-03 8:47 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
El Mon, 02 Oct 2006 22:20:36 -1000
Ben Munat <bent@munat.com> dijo:
> No, this will still require me to add a VirtualHost entry for the
> mail subdomain of every domain on my system... in addition to a
> document root mapping.
>
> I want *any* request with a host name starting with "mail" to map to
> the same directory on my server regardless of the domain name.
>
> And actually, your example wouldn't even work for one domain because
> you only get one DocumentRoot... this maps domain.com,
> www.domain.com, and webmail.domain.com to the same root.
Ahhh, ok, sorry, I misunderstood your question.
Maybe searching for the equivalent in apache for that lighttpd evhost
will work:
$HTTP["host"] =~ "^(mail.)?([^.]+)\.([a-z]{2,3})\.([a-z]{2,3})$" {
evhost.path-pattern = "/path/to/squirrel/"
...rewrites...here...
}
--
echo "dpefsAgmv{p/psh" | perl -pe 's/(.)/chr(ord($1)-1)/ge'
GnuPG key ID 0x6D2FF8B5 @ pgp.rediris.es
Gentoo Linux on IA32|sparc64
http://fluzo.org/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 8:24 ` Hans-Christian Otto
@ 2006-10-03 8:56 ` Ben Munat
0 siblings, 0 replies; 12+ messages in thread
From: Ben Munat @ 2006-10-03 8:56 UTC (permalink / raw
To: gentoo-server
Hans-Christian Otto wrote:
>> <VirtualHost *:80>
>> ServerName domain.com
>> ServerAlias www.domain.com
>> ServerAlias webmail.domain.com
>> ServerAlias ...
>> ServerAdmin ...
>> DocumentRoot "..."
>> ...
>> </VirtualHost>
>>
>> The same applies for SSL ports.
>>
>> No mod_rewrite needed for that.
> Guess he meant that this should happen automatically and he does'nt want to
> add the subdomain to every domain... Would be nice to know for me, too.
Right... plus I don't think the example given would even work if the
ServerAliases listed need to go to different directories. I don't think
there's any way to do this without mod_rewrite... hoping someone can
just slip me the correct rule.
b
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 8:47 ` Javier Barrio
@ 2006-10-03 13:47 ` Ben Munat
2006-10-03 14:22 ` Javier Barrio
0 siblings, 1 reply; 12+ messages in thread
From: Ben Munat @ 2006-10-03 13:47 UTC (permalink / raw
To: gentoo-server
Javier Barrio wrote:
> El Mon, 02 Oct 2006 22:20:36 -1000
> Ben Munat <bent@munat.com> dijo:
>
>> No, this will still require me to add a VirtualHost entry for the
>> mail subdomain of every domain on my system... in addition to a
>> document root mapping.
>>
>> I want *any* request with a host name starting with "mail" to map to
>> the same directory on my server regardless of the domain name.
>>
>> And actually, your example wouldn't even work for one domain because
>> you only get one DocumentRoot... this maps domain.com,
>> www.domain.com, and webmail.domain.com to the same root.
>
> Ahhh, ok, sorry, I misunderstood your question.
>
> Maybe searching for the equivalent in apache for that lighttpd evhost
> will work:
>
> $HTTP["host"] =~ "^(mail.)?([^.]+)\.([a-z]{2,3})\.([a-z]{2,3})$" {
> evhost.path-pattern = "/path/to/squirrel/"
> ...rewrites...here...
> }
>
Yeah... something like that. Time to get out the old regex assistant.
The hardest part of rewrite for me is it's always hunt and peck in the
dark.... I've never figured out how to get apache to log it's attempts
at matching.
b
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 13:47 ` Ben Munat
@ 2006-10-03 14:22 ` Javier Barrio
2006-10-04 4:55 ` Hans-Christian Otto
0 siblings, 1 reply; 12+ messages in thread
From: Javier Barrio @ 2006-10-03 14:22 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
> Yeah... something like that. Time to get out the old regex assistant.
> The hardest part of rewrite for me is it's always hunt and peck in
> the dark.... I've never figured out how to get apache to log it's
> attempts at matching.
IIRC Apache has a directive called RewriteLog and another one called
RewriteLogLevel that will help you arrive to good port.
dev-util/txt2regex can help you write the right rules.
--
echo "dpefsAgmv{p/psh" | perl -pe 's/(.)/chr(ord($1)-1)/ge'
GnuPG key ID 0x6D2FF8B5 @ pgp.rediris.es
Gentoo Linux on IA32|sparc64
http://fluzo.org/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 14:22 ` Javier Barrio
@ 2006-10-04 4:55 ` Hans-Christian Otto
2006-10-04 7:45 ` Nicolas MASSÉ
0 siblings, 1 reply; 12+ messages in thread
From: Hans-Christian Otto @ 2006-10-04 4:55 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 249 bytes --]
If one finds the solution for this - would be nice if he could write it to the
ML. Thanks,
Christian
-------------------
Hans-Christian Otto
www: http://muh-die-kuh.de
mail: c.otto@lab9.de
jabber: muh-die-kuh@jabber.ccc.de
icq: 127751895
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-04 4:55 ` Hans-Christian Otto
@ 2006-10-04 7:45 ` Nicolas MASSÉ
0 siblings, 0 replies; 12+ messages in thread
From: Nicolas MASSÉ @ 2006-10-04 7:45 UTC (permalink / raw
To: gentoo-server; +Cc: Hans-Christian Otto
[-- Attachment #1: Type: text/plain, Size: 804 bytes --]
Hello,
On Wednesday 04 October 2006 06:55, Hans-Christian Otto wrote:
> If one finds the solution for this - would be nice if he could write it to
> the ML. Thanks,
You can use "mod_vhost_alias"
In your httpd.conf :
LoadModule vhost_alias_module modules/mod_vhost_alias.so
The virtual host declaration :
<VirtualHost _default_:80>
VirtualDocumentRoot "/var/www/%1"
</VirtualHost>
Then, you just have to put your web pages under /var/www/mail.
It should work. If it doesn't work, let me know. More information are at :
http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html
--
Nicolas MASSÉ
Pour récupérer ma clef GPG:
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 0x2A18C433
Key fingerprint: 6621 FC23 5DC7 54BA B952 316A 50B1 BC3F 2A18 C433
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-03 7:21 [gentoo-server] apache config question Ben Munat
2006-10-03 7:32 ` Javier Barrio
@ 2006-10-05 2:13 ` Michael Stewart (vericgar)
2006-10-05 3:20 ` Ben Munat
1 sibling, 1 reply; 12+ messages in thread
From: Michael Stewart (vericgar) @ 2006-10-05 2:13 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]
Ben Munat wrote:
> Hello. Does anyone know how I can configure apache 2.0.x to map all
> requests to a given subdomain to a give directory regardless of the rest
> of the server name?
>
> Doing this for my webmail setup... so mail.foo.com, mail.bar.com,
> mail.baz.com, etc. should all map to my squirrelmail directory.
>
> I've been doing this by adding virtual host directives for the mail
> subdomain for every domain I add but it seems like there should be an
> easier way. I figure I can probably do it with mod_rewrite but I'm no
> wizard with that.
>
> thanks,
>
> b
If I understand you right, you want mail.* to point to say /var/www/mail
, while letting other domains/subdomains point to their own places.
Here's how I handle it on my server:
<VirtualHost *:80>
ServerName mail.your-domain.com
ServerAlias mail.*
DocumentRoot /var/www/mail
[... other configuration as needed ...]
</VirtualHost>
This needs to be one of the first virtual hosts that apache reads so
that it matches mail.* before it matches say *.blahblah.com (if you are
hosting blahblah.com)
--
Michael Stewart vericgar@gentoo.org
Gentoo Developer http://dev.gentoo.org/~vericgar
GnuPG Key ID 0x08614788 available on http://pgp.mit.edu
--
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-05 2:13 ` Michael Stewart (vericgar)
@ 2006-10-05 3:20 ` Ben Munat
2006-10-05 4:30 ` James Hiscock
0 siblings, 1 reply; 12+ messages in thread
From: Ben Munat @ 2006-10-05 3:20 UTC (permalink / raw
To: gentoo-server
Hah... didn't think you could put a * in the ServerAlias... haven't
found any documentation to that effect. But I'll try this.
And Nicholas, I haven't had a chance to try your solution yet, but I
appreciate it. Thanks to everyone who tried to help. I can probably get
one of these to work.
b
Michael Stewart (vericgar) wrote:
> Ben Munat wrote:
>> Hello. Does anyone know how I can configure apache 2.0.x to map all
>> requests to a given subdomain to a give directory regardless of the rest
>> of the server name?
>>
>> Doing this for my webmail setup... so mail.foo.com, mail.bar.com,
>> mail.baz.com, etc. should all map to my squirrelmail directory.
>>
>> I've been doing this by adding virtual host directives for the mail
>> subdomain for every domain I add but it seems like there should be an
>> easier way. I figure I can probably do it with mod_rewrite but I'm no
>> wizard with that.
>>
>> thanks,
>>
>> b
>
> If I understand you right, you want mail.* to point to say /var/www/mail
> , while letting other domains/subdomains point to their own places.
>
> Here's how I handle it on my server:
>
> <VirtualHost *:80>
> ServerName mail.your-domain.com
> ServerAlias mail.*
> DocumentRoot /var/www/mail
> [... other configuration as needed ...]
> </VirtualHost>
>
> This needs to be one of the first virtual hosts that apache reads so
> that it matches mail.* before it matches say *.blahblah.com (if you are
> hosting blahblah.com)
>
--
gentoo-server@gentoo.org mailing list
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-server] apache config question
2006-10-05 3:20 ` Ben Munat
@ 2006-10-05 4:30 ` James Hiscock
0 siblings, 0 replies; 12+ messages in thread
From: James Hiscock @ 2006-10-05 4:30 UTC (permalink / raw
To: gentoo-server
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
>> I've been doing this by adding virtual host directives for the mail
>> subdomain for every domain I add but it seems like there should be an
>> easier way.
That's because there is (well, _I_ find it far easier, at least ;)
http://httpd.apache.org/docs/2.0/vhosts/mass.html
[-- Attachment #2: Type: text/html, Size: 379 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-10-05 4:33 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-03 7:21 [gentoo-server] apache config question Ben Munat
2006-10-03 7:32 ` Javier Barrio
2006-10-03 8:24 ` Hans-Christian Otto
2006-10-03 8:56 ` Ben Munat
[not found] ` <45221D54.8060906@munat.com>
2006-10-03 8:47 ` Javier Barrio
2006-10-03 13:47 ` Ben Munat
2006-10-03 14:22 ` Javier Barrio
2006-10-04 4:55 ` Hans-Christian Otto
2006-10-04 7:45 ` Nicolas MASSÉ
2006-10-05 2:13 ` Michael Stewart (vericgar)
2006-10-05 3:20 ` Ben Munat
2006-10-05 4:30 ` James Hiscock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox