How to host subdomain on a different server than the main domain?

skrl

Member
Mar 18, 2021
22
5
3
Kingston
cPanel Access Level
Website Owner
I have mydomain.com served from Host A (IIS). mydomain.com is developed with ASP.NET.

I need to serve a subdomain.mydomain.com from Host B (Apache). subdomain.mydomain.com will be developed with Drupal.

I thought all I would have to do would be to create an A record in my registrar's DNS nameservers to point to the public IP of the Host B, and that would be it, and I would be able to then proceed with my installation as soon as the DNS propagation would have finished. My Host B support team says that that would not work, although they haven't made it crystal clear why. They've said it's something to do with the virtual machine engine the WHM has been installed on to. Please kindly note that the Host B is a dedicated server, and I would expect there would be more flexibility in terms of available options.

I am mostly front-end oriented, and I need to better understand why that would be the case.

Would you happen to have available any resources I could spend time reading to better educate myself on this?

Any obvious insight at hand that I might be overlooking would be also really appreciated.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,796
1,529
313
cPanel Access Level
Root Administrator
Hey there! As far as the internet portion of the traffic, you are correct - you just need the A record where your DNS is hosted to point to the correct system.

However, you also need to have the correct entries setup on that webserver as well. For example, on a cPanel machine, you'd need to ensure the subdomain is created in cPanel or else Apache won't know where to serve the content from. Even though the DNS may be pointed properly, the webserver side still needs to exist so it knows how to handle that.

Maybe that is what they were getting at?
 

skrl

Member
Mar 18, 2021
22
5
3
Kingston
cPanel Access Level
Website Owner
Hey, thank you for your prompt input. So when the account for the subdomain is created, would that be all on the server side under regular configuration?

By the way should there be any problem whatsoever creating the cPanel account, and associating it with the subdomain.mydomain.com as the primary domain? Does cPanel really care if that domain name already exists or not? Or does it care whether it is pointed to a different host or not? To my knowledge it does not, but I just want to double check because I am at a point where I am doubting everything I think I knew...

The server hosts another installation as well. There's only one public IP, and zero dedicated ones. But I would not expect that to be a problem; when you purchase a shared hosting plan that is usually the case also, isn't it?

How do you generally go about doing such implementations as the one I am trying to achieve here? (edit: What settings should I ask them if they have set them up correctly?)
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
711
277
363
cPanel Access Level
DataCenter Provider
It's easy and we do this all the time:

  • On Server-A create mydomin.tld ( your IIS server)
  • On Server-B create subdomain.mydomain.tld (the cPanel server)
Then in your DNS you just need to create the "A" record to point subdoamin.mydomain.tld to the IP assigned in cPanel.

cPanel is perfectly happy to create the account as a sub-domain.
 

skrl

Member
Mar 18, 2021
22
5
3
Kingston
cPanel Access Level
Website Owner
It's easy and we do this all the time:

  • On Server-A create mydomin.tld ( your IIS server)
  • On Server-B create subdomain.mydomain.tld (the cPanel server)
Then in your DNS you just need to create the "A" record to point subdoamin.mydomain.tld to the IP assigned in cPanel.

cPanel is perfectly happy to create the account as a sub-domain.
So I should not need a dedicated public IP just for every individual cPanel installation. I just need a cPanel account for every installation, with subdomain.mydomain.com as my primary domain associated with this one account in this case. Then the A record goes in my DNS, and the rest should be taken care of by the cPanel and/or Apache; have I got it down right? No special back-end handling on behalf of Host B?

That is how I had everything in my mind to start with, but then my back-end support said it can't be done, or it wil not work, or it is not as easy and what not, and got me into doubts.
 

PeteS

Well-Known Member
Jun 8, 2017
299
65
28
Oregon
cPanel Access Level
Root Administrator
Will this also work if the subdomain is a set up as an addon domain? Like this:

Server A hosts example.com
Server B hosts domain.com

Can I do this on server B? --> setup an addon domain in domain.com's account of subdomain.example.com Or will this yell at me because example.com is DNSed to another server?

For DNS, A & B are in the same DNS cluster. Not sure if that helps or complicates, but you would need to make sure example.com's DNS zone points subdomain.example.com to the shared IP of domain.com's server, and if a DNS zone was also created for subdomain.example.com I would assume that could be deleted.

Am I crazy? ;)
 

PeteS

Well-Known Member
Jun 8, 2017
299
65
28
Oregon
cPanel Access Level
Root Administrator
I'm not crazy... it works fine. :)

I had some time to test this and got it working pretty easily. I was testing on a non-clustered server, but I think it shouldn't matter. I did have to enable the proper nameserver IP for the test domain in Home / IP Functions / Configure Remote Service IPs.

The only correction I would make is to the DNS comment... YES to making the example.com DNS zone point subdomain.example.com to the domain.com IP, but NO to deleting the DNS zone on domain.com's server created for subdomain.example.com.
 
Last edited:
  • Like
Reactions: cPRex