Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Mar 2012 02:00:39 -0500 (CDT)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        dghughes82@googlemail.com, freebsd-questions@freebsd.org
Subject:   Re: Virtual Hosts & Subdomains
Message-ID:  <201203170700.q2H70dwF096801@mail.r-bonomi.com>
In-Reply-To: <4F638434.3090207@googlemail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

David Hughes <dghughes82@googlemail.com> 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.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203170700.q2H70dwF096801>