[TriLUG] Apache Virtual Hosts Question
Tanner Lovelace
lovelace at wayfarer.org
Mon Nov 3 11:04:49 EST 2003
Joshua Gitlin wrote:
> Hey everyone,
>
> I have a question about Apache's Virtual hosts. Let's say that I have a
> few directories, "host1", "host2", "host3", all in one parent directory,
> "sites". is there any way that I can configure apache to automatically
> serve requests for host1.mydomain.com from the "host1" folder, and
> requetss from "host2.mydomain.com" from the "host2" folder? I know I can
> configure virtual hosts for each, but I'm trying to avoid that -- I want
> to be able to just add a new directory and have a new host. How do these
> free web hosting services do it? (You know, the ones where you sign up
> as "username" and instantly your website is at
> http://username.freehost.com/")?
I do this exact thing using mod_vhost_alias. I even have my setup
switch on both the domainname and the hostname. For instance I set
my directory up this way:
/var/www/hosts/<domainname_minus_top_level>/<hostname>/
Then, if a request comes in for http://hostname1.domainname1.<whatever>/
it serves up what's in /var/www/hosts/domainname1/hostname1/. A request
for http://hostname2.domainname2.<whatever>/ serves what's in
/var/www/hosts/domainame2/hostname2/. It's really quite flexible and you
you can do a lot more with it too. See the links John Beimler
gave for a good discussion of the overall techniques and these links
for specific mod_vhost_alias options:
1.3: http://httpd.apache.org/docs/mod/mod_vhost_alias.html
2.0: http://httpd.apache.org/docs-2.0/mod/mod_vhost_alias.html
Cheers,
Tanner
--
Tanner Lovelace | lovelace(at)wayfarer.org | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint = A66C 8660 924F 5F8C 71DA BDD0 CE09 4F8E DE76 39D4
GPG Key can be found at http://wtl.wayfarer.org/lovelace.gpg.asc
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
"Computer games don't affect kids; I mean if Pac-Man affected us as
kids, we'd all be running around in darkened rooms, munching magic
pills and listening to repetitive electronic music."
Kristian Wilson, Nintendo, Inc, 1989
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 222 bytes
Desc: not available
URL: <http://www.trilug.org/pipermail/trilug/attachments/20031103/60145b2e/attachment.pgp>
More information about the TriLUG
mailing list