[sllug-members]: httpd.conf question

Lamont Peterson lamont at gurulabs.com
Tue Aug 14 11:59:43 MDT 2007


On Monday 13 August 2007 10:02pm, Clint Savage wrote:
> On 8/13/07, Adam Barrett <dragen at gmail.com> wrote:
> > I am going to be setting up a bunch of domains to redirect to one...
> > is this a valid VirtualHost entry?
> >
> > <VirtualHost *>
> >      ServerName www.domain.com
> >      ServerAlias   *.domain.*
> >      DocumentRoot /my/domain
> > </VirtualHost>
> >
> > Would that capture all the .net .org .biz etc? Or would it fail
> > miserably?
>
> According to the documentation on apache's site[1], this would
> probably work.  My recommendation would to be to add one entry for
> each to be explicit.  Its possible that if you own x.domain.org, you
> may want it to be managed elsewhere at some point.

That's excellent advice.  However, there's a more important reason to never do 
do "*.domain.*"; That would be trying to match on *anything* and I doubt 
you've registered "domain" in ever TLD there is.  Remember, there are all the 
ISO country codes (over 300 of them) plus things 
like .com, .net, .org, .int, .mil, .gov, .biz, .info, .name, .mobi, etc.  You 
do not want your server handling domains that you haven't registered.  Many 
web applications could experience (typically minor) difficulties if you do.

> Also, I'd suggest you consider making sure that you cover domain.com
> as well.  To me, its smart to make sure that your domain.com and
> www.domain.com point to the same data.  Its easy to do and I wonder
> why more people don't.
>
> Here's what I'd do:
>
> <VirtualHost *:80>
>     ServerName www.domain.com
>     ServerAlias   domain.org domain.biz domain.net domain.com
> *.domain.com *.domain.org *.domain.biz
>     DocumentRoot /my/domain
> </VirtualHost>
>
> I'm not sure why, but that still bugs me, though it should technically
> be correct.  Probably just my eccentricity shining through. o_O

Possibly because you would be handing out the exact same content for different 
domains.  If you want your other domains to all point to www.domain.com, I 
would create two virtual hosts where the first is for www.domain.com and the 
second would have the ServerAlias list and a redirect to www.domain.com.

> 1- http://httpd.apache.org/docs/2.2/mod/core.html#serveralias
[snip]
-- 
Lamont Peterson <lamont at gurulabs.com>
Senior Instructor
Guru Labs, L.C. [ http://www.GuruLabs.com/ ]

NOTE:  All messages from this email address should be digitally signed with my
       0xDC0DD409 GPG key. It is available on the pgp.mit.edu keyserver as
       well as other keyservers that sync with MIT's.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://sllug.org/pipermail/sllug-members/attachments/20070814/f9e53811/attachment.pgp


More information about the sllug-members mailing list