Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2000 23:21:52 -0800
From:      Doug Barton <Doug@gorean.org>
To:        Jim Flowers <jflowers@ezo.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Apache Virtual Host Setup Confusion
Message-ID:  <38D08B90.64B137BA@gorean.org>
References:  <004f01bf8ec0$96d4d9a0$81d396ce@ezo.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Jim Flowers wrote:
> 
> In trying to understand the Apache documentation on virtual host setup I
> have become confused 

	Easy to do with apache. :)

> (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

	Assuming that your DNS is correct and all of the names ultimately
resolve to your IP, this is irrelevant. BTW, you don't have much to fear
using real info, and it makes debugging easier, but it's up to you. 

> 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

	Here is where you run into trouble. You missed the bit of the docs
where it says that if you define a vhost on the same IP as the "main"
server, apache won't respond to anything other than the vhosts. 

> NameVirtualHost 222.222.222.222

Add:

<VirtualHost 222.222.222.222>
	ServerName host.domain.tld
	ServerAlias www.domain.tld
	DocumentRoot /www/domain
</VirtualHost>

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

[snip]

>  You can't configure a default
> server to trap unmatched virtual host servers?

	Take a look at the sample httpd.conf file. The entry you want is
<VirtualHost _default_:*>
 
Good luck,

Doug
-- 
  "While the future's there for anyone to change, still you know it
seems, 
   it would be easier sometimes to change the past"

       - Jackson Browne, "Fountain of Sorrow"


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?38D08B90.64B137BA>