Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2000 15:53:59 -0500
From:      "Jim Flowers" <jflowers@ezo.net>
To:        <freebsd-questions@freebsd.org>
Subject:   Apache Virtual Host Setup Confusion
Message-ID:  <004f01bf8ec0$96d4d9a0$81d396ce@ezo.net>

next in thread | raw e-mail | index | archive | help
In trying to understand the Apache documentation on virtual host setup I
have become confused  (FreeBSD 3.4-STABLE, apache+php-1.3.12+3.0.15).  It
seemed to be straightforward enough to set up a main server, a virtual host
server and a default server.  First I set up the main server with:

DNS set up for:
----------------------
host.domain.tld.    IN    A    222.222.222.222
www.domain.tld    IN    CNAME host.domain.tld.

apache.conf includes main references (outside any <VirtualHost> container>
----------------------------------------------------------------------------
ServerName host.domain.tld
DocumentationRoot /www/domain

Browser references to host.domain.tld, www.domain.tld and 222.222.222.222
all display the index.html document in /www/domain.  Hooray.

Continuing,I add a virtual host for www.domain1.tld

DNS
-------
www.domain1.tld    IN    CNAME host.domain.tld.

and

NameVirtualHost 222.222.222.222
<VirtualHost 222.222.222.222>
ServerName www.domain1.tld
DocumentRoot /www/domain1
</VirtualHost>

Now, browser references to www.domain1.tld, www.domain.tld, host.domain.tld
and 222.222.222.222 all bring up the index.html page from /www/domain1.
Nothing will show /www/domain documents.

Finally I added:

DNS
-----
bogus.domain.tld    IN    CNAME    host.domain.tld

and:

<VirtualHost _default_:*>
DocumentRoot /www/default
</VirtualHost>

You guessed it.  Nothing changed except now browser references to
bogus.domain.tld also display www.domain1.tld documents.

This seems to be quite contrary to the Apache vhost documentation.  Is it
really the way it is supposed to work?  You can't have a main server that is
independent of the virtual host servers?  You can't configure a default
server to trap unmatched virtual host servers?

I can design workarounds easily enough but this sounds like I have something
configured improperly or that I can't read the documentation properly.

Any help will be appreciated.

Thanks

Jim Flowers mailto:jflowers@ezo.net



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?004f01bf8ec0$96d4d9a0$81d396ce>