Tuesday, June 18, 2013
0 comments

Website Domain Name Configuration

11:07 AM
Domain Name Configuration
Before understanding how to configure a domain name, one should know how a domain name works. There are three parts to setting up a domain name for a website - (i) registering the domain name with a domain registrar, (ii) setting up the domain name entry in a DNS server, and finally (iii) configuring the web server to listen to the requests for the domain name. A request for the domain (e.g. http://websitegear.com) starts at one of the registrar's server, which then routes it to a DNS server containing the DNS information for the domain. Once the DNS record for the domain resolves the domain name to a particular IP address, the request is sent to the web server listening to that IP address. The web server can now delegate the request to the particular website based on the domain name in the host header of the request object.

Registering A Domain Name
A domain name needs to be registered with one of the ICANN (http://www.icann.org) approved domain registrars for a yearly registration fee. One of the cheapest registrar with all the required features is GoDaddy.com (http://www.godaddy.com). There are registrars for each country specific domain names (such as .co.uk for United Kingdom, .nl for Netherlands). One should choose a domain name very carefully. After deciding on an available domain name, one has to provide the following information during the registration process:
  1. Domain name owner credentials (name, company name, address, phone, email address etc.)

  2. Administrative contact credentials

  3. Technical contact credentials

  4. Domain Name System (DNS) server details

The DNS server (also known as name server) is usually provided by the web hosting company. The DNS server should have entries of the domain name as explained in the next section. At least a primary (e.g. ns1.websitegear.net) and a secondary (e.g. ns2.websitegear.net) name server addresses are required. DNS server setup requires extra knowledge and is not within the scope of this article.

Domain Setup On DNS Server
The domain setup on the DNS server can be done after the domain is registered, however, the domain name will not work until the DNS setup is completed. A DNS server maps a domain name to IP address(es) of the web server and mail server so that a client can connect to the webserver or mail server using the domain name and not the IP address. A forward lookup zone is created for the domain name in the DNS server. Start of authority (SOA), Name server (NS), Hostname (A), Canonical Names (CNAME) and Mail eXchange (MX) entries are added to the forward lookup zone as shown below for a domain "foodomain.com" with name servers "ns1.dnsserver.com" and "ns1.dnsserver.com".

Start Of Authority (SOA) Record: The SOA record is very important because it denotes the official DNS record for the domain name. There can be only one SOA record for each domain in a zone file.

@ IN SOA ns1.dnsserver.com. hostmaster.dnsserver.com. (
20041014 ; serial number
900 ; refresh
600 ; retry
86400 ; expire
3600 ) ; default TTL


Address (A) Record Entry: The address (A) record is added to the forward lookup zone of the domain and it is associated with the IP addresses of the web server, which will handle the requests for the domain. There can be multiple A records, in which case, it will use the round robin DNS load balancingmechanism to assign the requests.

foodomain.com IN A 123.2.33.45.
foodomain.com IN A 123.2.33.46.


Alias (CNAME) Entry: A canonical name (CNAME) record maps an alias to the real name, Note that an alias for www is setup as a CNAME, so that requests to www.domain.com is sent to the same website that handles the requests for domain.com.
www IN CNAME foodomain.com.


Name Server (NS) Record: The NS record is used to define the name servers for the domain. It may seem unnecessary to keep a record of the name server in the DNS entry because the name server lookup is already present in the registrar records, where the lookup for the domain starts. This record is needed, incase, someone requires to know the name servers for this domain. The NS records are mapped to CNAME entries (ns1 and ns2 in the example below).

foodomain.com IN NS ns1.dnsserver.com.
foodomain.com IN NS ns2.dnsserver.com.


Mail Exchanger (MX) Setup: The mail exchanger domain configuration is required if an email server is setup to handle the domain mail accounts. For example, an email address like joe@foodomain.com will require a domain setup for resolving the mail server for foodomain.com. The setup is similar to the CNAME setup but with MX records. There can be multiple MX records (e.g. for backup mail servers).

foodomain.com IN MX 10 mail.foodomain.com.


Note: Test the DNS setup of the domain using DNSReport.com. This site provides a detailed report of any DNS misconfigurations and possible solutions.

Configuring Web Server For Domain
Once the DNS server is setup to send the request for the domain to the corresponding IP address, the work of the web server begins. The web server needs to be configured appropriately to handle the request for the domain based on either the IP address or the host header entry. Host headers are commonly used by web servers to host multiple domains on one IP address.

Microsoft Windows IIS : In case of Internet Information Server (IIS), create a new web site for the domain using the IIS Manager, and add the domain (e.g. domain.com) as a new host header value listening to the same IP address as specified in the DNS entry. The port is set to 80 (the default for http requests). The host header can be added by clicking on the advanced tab next to the IP address configuration for that web site application. Set the home directory for the domain web site to the directory (e.g. C:\Inetpub\wwwroot\). Add another host header entry for www.foodomain.com so that anyone can access the website when typing with www in the beginning.

Apache Web Server : In case of Apache web server, the subdomain is configured by virtual host entries in httpd.conf as shown below.

Listen 80
NameVirtualHost *

<VirtualHost *>
ServerName www.domain.com
DocumentRoot /home/httpd/htdocs/
</VirtualHost>

<VirtualHost *>
ServerName domain.com
DocumentRoot /home/httpd/htdocs/
</VirtualHost>


Conclusion
Domain configuration starts with an entry with a domain registrar, and the registrar record maps the domain to name servers, which contains the detailed DNS entries for the domain. The lookup for the domain name at the designated DNS server resolves the domain to an IP address of the web server. The web server in turn delegates the requests based on its configuration for the domain.

0 comments:

 
Toggle Footer