WebsiteGear Logo Log In
New User? Sign Up
About | Contact | FAQ
  Home Content Web Hosting Friday, April 18, 2014 
Print| Email| Save| Discuss| Feeds


Subdomain Configuration
Published: Monday, August 16, 2004


Subdomain Configuration
A subdomain configuration is very similar to a domain name configuration. The only difference is that the subdomain entry is tied to the corresponding domain name lookup. A request for the subdomain (e.g. http://content.websitegear.com) will be routed to a DNS server containing the DNS information for the parent domain (websitegear.com). Once the DNS record for the subdomain is resolved to a particular IP address, the request is sent to the web server listening on that IP address. The web server can now delegate the request to the particular website based on the subdomain name in the host header of the request object. Various combinations of subdomain configurations are possible by using DNS server entries and web server application setup for load distribution, application isolation or security purposes.

Subdomain Setup on DNS server
The forward lookup zone of the parent domain in the DNS server should contain a pointer to the sub domain using either an alias (CNAME), a hostname (A) or a mail enchanger (MX) entry. The alias (CNAME) record is used for a subdomain if the subdomain points to a website running on the same web server at the same IP address as the parent domain website. A new hostname (A) record is used if the subdomain points to a different web server, or to the same web server listening on a different IP address (as in the case of load distribution).

Alias (CNAME) Setup: An alias points the subdomain to the same web server, which hosts the website for the parent domain. The canonical names (CNAMES) are added for each of the subdomains as shown below. Once the subdomain is resolved to the IP address of the web server, the web server can route the request to a different website (see section on web server setup below). Note that an alias for www is setup as a subdomain by default by most hosting companies, so that requests to www.domain.com is sent to the same website that handles the requests for domain.com.

www IN CNAME domain.com.
subdomain1 IN CNAME domain.com.
subdomain2 IN CNAME domain.com.


Address (A) Record Setup: A hostname DNS entry is required if the subdomain is pointing to a different IP address than that set for the domain name. Add the address (A) records to the forward lookup zone of the parent domain and associate the address records with the IP addresses of the web servers, which will handle the requests for the subdomain.

subdomain1 IN A 123.2.33.45.
subdomain2 IN A 123.2.33.46.


Mail Exchanger (MX) Setup: The mail exchanger subdomain configuration is required if an email server is setup to handle the subdomain mail accounts. For example, an email address like joe@arts.myschool.edu will require a subdomain setup for resolving the mail server for arts.myschool.edu. The setup is similar to the CNAME setup but with MX records.

subdomain1 IN MX 10 subdomain1.domain.com.
subdomain2 IN MX 10 subdomain2.domain.com.


Note: If the sub-domain is configured on another DNS name server, a Name Server (NS) record has to be created for the sub-domain on the corresponding domain name DNS server, so that it can delegate the sub-domain lookup to the other name servers. Using different name servers can eliminate security issues in cases where the sub-domains are maintained by separate administrators. However, the lookup carries an additional overhead.

Configuring the web server for sub-domains
Once the DNS server is setup to send the request for the sub-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 sub-domain based on either the IP address or the host header entry. Host headers are commonly used by web servers to host multiple domains or sub-domains on one IP address.

Microsoft Windows IIS : In case of Internet Information Server (IIS), create a new web site for the subdomain using the IIS Manager, and add the sub-domain (e.g. subdomain.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. If the subdomain points to a subdirectory of the web site for the domain, then set the home directory for the subdomain web site to the subdirectory. For example, if the domain.com points to C:\Inetpub\wwwroot\ and the subdomain needs to be setup for C:\Inetpub\wwwroot\subdomain, then the directory for the subdomain website should be set to C:\Inetpub\wwwroot\subdomain.

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 subdomain.domain.com
DocumentRoot /home/httpd/htdocs/subdomain/
</VirtualHost>


Conclusion
Sub-domain configuration starts with an entry in the DNS server of the parent domain and the lookup resolves the sub-domain to an IP address of the web server. The web server in turn delegates the requests based on its configuration for the sub-domain. Various sub-domain configurations can be used effectively to distribute the load evenly among available web applications or web servers listening to different IP addresses. The load distribution is achieved by the DNS round robin feature of the BIND. Other uses include application isolation, simpler and professional looking URL, content categorization etc.
Previous Article Tips On Using SubDomain
Print| Email| Save| Discuss| Feeds
RELATED ARTICLES
Nav SubDomain - The Third Level Domain
A subdomain is the part of the website address before the domain name. Learn about using subdomain names.
Nav Introduction To Server Load Balancing
Load balancing applies to all types of servers (application server, database server), however, we will be devoting this section for load balancing of web servers (HTTP server) .
RELATED NEWS
News Post Global Data Center Network Equipment Market 2014-2018
DUBLIN, April 17, 2014 /PRNewswire/ -- Research and Markets ( http://www.researchandmarkets.com/research/nq7jmc/global_data)...
News Post Saint-Gobain Joins BlackLine Systems, SAP, ACCA for Webinar on Automating Account Reconciliations as a Critical Step to 'Closing with Confidence'
Director of Finance Shared Services from construction giant to discuss benefits of BlackLine, cost-savings realised since using BlackLine Financial Close Suite for SAP® Solutions, an SAP-endorsed business solution
News Post Global Heterogeneous Networks Market 2014-2018
DUBLIN, April 18, 2014 /PRNewswire/ -- Research and Markets (http://www.researchandmarkets.com/research/r6g95t/global) has an...
News Post Global BYOD Security Market 2014-2018
DUBLIN, Ireland, April 17, 2014 /PRNewswire/ -- Research and Markets ( http://www.researchandmarkets.com/research/68g4h9/glob...
News Post Diyotta DI Suite is now Cloudera Enterprise 5 certified
Diyotta DI Suite integrates and provides maximum flexibility with the latest version of Cloudera Enterprise enabling Enterprise Data Hub architecture
Submit News | View More NewsView more news
RELATED CLASSIFIED ADS
Classified Ad ClubVPS – True Cloud In New York/Hong Kong/IL/Am
http://www.clubvps.com/products/cloud" provide reliable, professional, High Availability Cloud ...
Classified Ad Looking for a Sr. Software Engineer in Vadodara
Sanah Infosolutions , Vadodara (www.sanahgroup.com) is looking for Sr. Software Engineer for its Cl ...
Classified Ad HTML TAGGING PROJECT CONVERSION AVAILABLE
We have developed HTML Tagging Conversion software which can convert any TIFF Frech Srcipt Image to ...
Classified Ad PRACTICAL SQL DBA ONLINE TRAINING with PROJECT
SQL School is one of the pioneers IT Institutions providing specialized in SQL Server 2012 DBA Train ...
Classified Ad Society Software in Jodhpur
A complete IT solution for Co-Operative Society. Sahakaar is Society Software in Jodhpur specially d ...
Post Free Ad | View More View more classifieds
RELATED FORUM POSTS
Forum Post Strange problem with domain name configuration
We have a few domain names registered with Network solutions. Recently, we changed web hosts. In t ...
Forum Post Configuring BIND on windows 2003 server VPS
Hi Guys, I have a Windows 2003 Virtual Private Server and I'm trying to configure it with a BIND ...
Forum Post Parent servers say that the domain does not exist
I have a certain question related to DNS configuration: 1) a week ago my internet domain SKARBIEC ...
Forum Post 8 Steps to Choosing the Right Web Host
Here is an article I wrote a while ago but figured I would share this with other people for their co ...
Forum Post DIY photo collage yearbook with digital photos
Christmas is coming and a year also comes to its end right away. From beginning to end, from spring ...
Add New Post | View More View more forum posts
POPULAR ARTICLES
Nav How To Sell A Website
Nav Subdomain Configuration - How To Setup A Sub Domain
Nav Website Layout - Tips & Tricks
Nav Domain Configuration - How To Setup A Domain Name
Nav Round Robin DNS Load Balancing
Nav Introduction To Server Load Balancing
Nav Website Traffic & Revenue
Nav Tips On Using SubDomain
FEATURED NEWS | POPULAR NEWS
View More News View More News