From owner-freebsd-questions@FreeBSD.ORG Sun Apr 24 13:35:11 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3970D16A4CE for ; Sun, 24 Apr 2005 13:35:11 +0000 (GMT) Received: from ylpvm29.prodigy.net (ylpvm29-ext.prodigy.net [207.115.57.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9024F43D49 for ; Sun, 24 Apr 2005 13:35:10 +0000 (GMT) (envelope-from duo@digitalarcadia.net) Received: from pimout3-ext.prodigy.net (pimout3-ext.prodigy.net [207.115.63.102])j3ODYWD5032017 for ; Sun, 24 Apr 2005 09:34:32 -0400 X-ORBL: [68.254.50.75] Received: from digitalarcadia.net ([68.254.50.75])j3ODZ55Y250682; Sun, 24 Apr 2005 09:35:09 -0400 Received: from [10.0.1.69] (ticklebomb.digitalarcadia.net [10.0.1.69]) by digitalarcadia.net (Postfix) with ESMTP id 8B6391C19CE; Sun, 24 Apr 2005 08:36:49 -0500 (CDT) Message-ID: <426B9086.3030507@digitalarcadia.net> Date: Sun, 24 Apr 2005 07:26:46 -0500 From: Duo User-Agent: Mozilla Thunderbird 1.0 (X11/20050422) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Perttu Laine References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: apache vhost help. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2005 13:35:11 -0000 Perttu Laine wrote: >I have domain configured so *.domain.tld are A record to same IP. Now >I have apache vhosts so www.domain.tld and domain.tld goes to apache >data dir and webmail.domain.tld goes to webmail data dir. >Problem is howto forward those all others to certain directory. s it >possible to make *.domain.tld vhost to go in one dir. so anything else >than domain.tld, www.domain.tld and webmail.domain.tld goes to like /www-data/somedir. > >One solution would be make that somedir to default root, but cannot >use it 'cause I have other domains on same apache taht I have to >handle differently. > >Someone known what I mean? Or even how to do this? :) > > > Yes. It is quite simple. Check out the following example, this is currently how I am setup. I use a straight Bind directive: BindAddress * and then, we add the name directive: NameVirtualHost * Then, we can add as many hostnames (provided they have a domain record. They MUST have a valid domain record. Either an A or an Alias) ServerName www.domain1.com DocumentRoot /path/to/first/dir ServerName www.domain2.net DocumentRoot /a/different/pathname Now, we get freaky. ServerName duo.domain2.net DocumentRoot /path/to/my/home/dir/duo ServerName someonelse.domain1.com DocumentRoot /path/to/entirely/different/place Now, in the above example, my main server Document Root is the same as my Virtual host for www.domain2.net. As long as you have legal hostnames, you can define them as a Virtual Host. Name based Virtual hosting is well described in the apache manual. As it relies mostly on the browser telling the server what name its looking for. Try it and test. Make a copy of your httpd.conf and play a bit. =) -- Duo.