hosting domain and subdomain on two different servers

Solved: Hosting Domain & Subdomain on different Servers

April 18, 2020

Sometimes, situations come up when we need to host different parts of a website on different servers. A common case is email servers of a domain that is hosted on a different host and the regular website is on a different host. This is done by routing email handling using MX records of a domain.

But, there are situations when we have domain.com on server 1 and subdomain.domain.com on server 2. e.g In some case we may need to have the CRM part of the website developed by one company and website front-end developed by another company. The sensitive nature of data collected by the CRM may require it to be kept isolated from the regular website.

So, how do we host a subdomain and domain on two different servers?

Generally, to connect a domain to a particular server we set up nameserver at the domains registrar. But when we need to point domain to one server and subdomain to another server we cannot set two different sets of name servers. So, we set appropriate A records for domain and subdomain.

Here is an example how I set up subdomains and domains on two different servers on Godaddy registrar.

Step 1: Set up appropriate A Records in DNS Manager of your domain registrar

Setting up A records for domain and subdomain on Godaddy Registrar.

Note that I have set up 4 different IPs for different subdomains for one particular domain. I have highlited different setups in a different color for you quick understanding.

  • @ denotes the primary domain points to IP x.x.x.x
  • Subdomain crm.domain.com (A record) points to y.y.y.y
  • Sudomain lms.domain.com points to z.z.z.z and so on.

You can create a new A record in the DNS Zone Editor of your name server.
NOTE: This only works when the primary name server of your domain is set to your registrars default name servers.
Alternative: If you have already set a nameserver for the primary domain, then these A records will need to be created are the primary server’s WHM/cpanel or equivalent.

Step 2: Adding the required domain/subdomain to the appropriate server.

Now this step may be a little tricky. Follow the process mentioned below

  • Wait for the A records to propagate on NameServers and DNS records. It may take 30 minutes to 48 hours.
  • Add an addon domain to your hosting. Make sure you are adding the right subdomain to the right host. Cross check with IP address. Screenshot of domain addition is provided below taking cpanel as example.
  • In certain cases you may get error when adding the addon domain. In that case login to your WHM with root login >> Go to Server Configuration >> Tweak Settings >> Click on “Domains” Tab >> Allow Remote Domains set “On” >> Click “Save” at the bottom of the page.
Adding a subdomain on different server using addon domain feature of cpanel/whm

Latest Posts

Rooturaj Pattanaik

Technology & Business Consultant with customers across 6 countries. A doting father and loving husband writing about various topics like Technology, Travel, Society, Digital marketing, Investment consulting etc.

MY DICTIONARY PROJECT

I have started a new project called the Indic Dictionary. This will cover popular household words in India and what they are called in various languages. Eventually, I will make this an easy to use app where where people can easily find something like “hing in English” or “Tea Tree Oil in Hindi” or “carrom seeds in Urdu”.
business center in delhi
Previous Story

Top 10 Awesome yet Affordable Business centers in Delhi

Next Story

Tips to Choose Summer Camp – Must Read before admission!

Latest from Programming

Go toTop

Don't Miss