The MapIt gadget
We provide a tool in the /sec-bin/ area which you can use to tell the webserver to do
different things based on the domain name the visitor is using to come to your site. With an IP based hosting account, you can use this
to do your own name based hosting. (e.g. unlimited domains for free!)
The mapit tool itself is very easy to use. However, getting the extra domains setup to work correctly can be a little more challenging.
I will provide a couple of sets of "cookbook type" instructions below, but since I prefer to understand what it
is that I am doing, I will try to explain that first.
The Theory
IP Based Hosting
First, we need to understand a little about how a webserver works. In the "old days", a web-browser would connect to a webserver and
simply request a page. More modern browsers send a few extra pieces of information (headers) along with the request for a page. One of
those "headers" is a "Host header", which is the name of the webserver that the web-browser is connecting to. In "really old days"
(before BareMetal got into web-hosting), a computer could only host one website. Someone got the bright idea that a webserver could
tell which IP address a web-browser was connecting to, and if the computer had multiple IP addresses, the webserver could serve a
different website for each IP address that the web-browsers connected to. This was how "virtual web hosting" was done in the mid 90s
when BareMetal.com started providing hosting.
IP based hosting is still relevant, because it allows you to implement your own named based hosting. If we have an IP based account
configured for you, then the webserver will serve all requests for that IP address out of your directory, and the mapit gadget can
configure how that is done based on the Host header.
Name Based Hosting
"Name based web hosting" is the process of serving different websites or different content based on the "Host" header that the
web-browser sends to the webserver. Normally a name based webserver is configured with a list of domains and corresponding directories
to serve content from.
Name Based Hosting - via the mapit gadget
With the mapit gadget, we combine IP based and name based hosting. With IP based hosting, all requests for an IP address are served
from one directory tree. Since we run a highly configurable webserver (Apache) which can read configuration information from the
directories it is serving files from, we can add rules that tell it to do different things based on the Host header, and thus implement
our own name based hosting. This is precisely what the mapit gadget does, it adds (mod_rewrite) rules to your .htaccess file to tell
the webserver to do different things based on what site name the web-browser is connecting to.
The Practice
Configuring DNS to get the web-browsers to connect directly to your specific IP address is the "hardest" part of getting mapit to
work. Traditional web-forwarding techniques (redirects, framesets, etc) don't work, as the browser is connecting to the name of the
basic site and not directly to the domain name you want to serve content for.
If you are familiar with DNS, then you will know that this is not that complicated. There are number of steps to be completed, but none
are very complicated.
I will cover three methods of getting DNS setup. The first assumes you run your own DNS servers, the second is getting
support@baremetal.com to do it, and the third is using our (free) domain-dns.com service.
Your own DNS servers
If you run your own DNS servers, we recommend you add a CNAME record for the new domain you want to point to your basic account, and
set the CNAME to the name of your basic account. (This is a tich slower to resolve than loading the IP address directly, but is far
easier to maintain, and won't break if we have to move the basic account to another IP address.)
Get support@baremetal.com to do DNS
This title is a bit of an over simplification, but basically, if you can change the DNS servers for the domain you want to use via
mapit to be ns/ns2/ns3.baremetal.com, then our techs can add it as an alias to your basic account. This has the side effect
(advantage?) that e-mail for the domain will work exactly the same as it does for your basic account. (And if your domain is registered
via BareMetal, we should even be able to change the DNS servers for you.)
Use domain-dns.com to do DNS
I'm going to describe the process for configuring your new domain to use domain-dns.com in two manners. The first is the "raw" steps,
which will be appropriate for folks who are _not_ using BareMetal's registration services. Then I'll follow it with the BareMetal
version.
To get domain-dns.com to do anything for your domain, you need to get the DNS servers for your domain (domain registration) set to
to be ns1.domain-dns.com ns2.domain-dns.com and ns3.domain-dns.com. Then you need to either login to your domain-dns.com account (or
create one if you don't have one). If the domain doesn't exist in domain-dns.com yet you will need to use the "add a zone" button to
add it.
Then you want to go into the "edit zone" link for the domain so that we can setup the CNAME records. You want to get the zone to look
like the simplified example below, where we are pointing example.com to "BASIC.COM" using a CNAME record.
For BareMetal registered domains, the process is similar, except that the my-account wizard can do most of the work in a single
step. (You can have the system change the DNS servers to the domain-dns.com ones, create a domain-dns.com account (if needed) and load
the zone for you via the "web service wizard".) Simply take the "My-Account" link from
http://baremetal.com/, login with your billing id and billing password, click on the domains list,
click on the domain you want to point at your basic account. On the resulting detail page there should be a link for either "add web
service" or "change web service", click on it, select "Set up custom DNS" (and click next), and select "finish" on the next page. Now
go back to the domain detail page (e.g. via the domains list). Click on the link for "Manage Forwarding/Custom DNS". This should take
you straight into domain-dns.com for the specific domain. You should be able to click on 'edit zone' and setup the CNAMEs as described
in the paragraph above.
|