From owner-freebsd-questions@FreeBSD.ORG Sat Mar 17 06:59:22 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75C76106566C for ; Sat, 17 Mar 2012 06:59:22 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 433F08FC08 for ; Sat, 17 Mar 2012 06:59:21 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q2H70dwF096801; Sat, 17 Mar 2012 02:00:39 -0500 (CDT) Date: Sat, 17 Mar 2012 02:00:39 -0500 (CDT) From: Robert Bonomi Message-Id: <201203170700.q2H70dwF096801@mail.r-bonomi.com> To: dghughes82@googlemail.com, freebsd-questions@freebsd.org In-Reply-To: <4F638434.3090207@googlemail.com> Cc: Subject: Re: Virtual Hosts & Subdomains X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Mar 2012 06:59:22 -0000 David Hughes wrote > Hi all, > > Forgive me if this is slightly off-topic, but I wonder if I could > trouble you for some advice about setting up website subdomains with > Apache. I currently have a website up and running on a jailed VPS; I've > been trying to set up subdomains so that one might navigate to a certain > area of the site by using a URL of the form blog.mywebsite.net rather > than mywebsite.net/blog. > > I've tried reading the official Apache documentation and a number of > tutorials that I've found online, but nothing I've tried has worked so > far. Do Virtual Hosts behave differently if they're within a jail? Or do > I need some sort of DNS registration for subdomains? I've been trying to > figure it out by myself, with little success so far - I'm quite new to this. This takes several things to make it work. 1) You must have DNS entries for all the various {foo}.domian.tld paths that you intend to use. CNAMEs that point to domain.tld will work, combined with an 'A' (and/or 'AAAA') records for the domin.tld name itself. You'll also need an rDNS record for the IP address -- that points to domiain.tld . This stuff is necessary so that a web browser knows how/where to find the server for {foo}.domiain.tld . 2) then you need to tell Apache that it is to services requests for multiple domain names. This is what the 'virtualhost' stuff in the Apache config file does. 3) the web browser *MUST* generate 'HTTP/1.1' queries -- where the hostname that one is expecting a response from is, itself, included in the request that is sent to the server at the 'resolved' IP address.