Mobile app version of vmapp.org
Login or Join
Kevin317

: Pointing subdomain to another server (Godaddy + CPanel) I've researched and tried a lot of solutions online, but none seems to solve my problem, it seems something is missing. I have domain

@Kevin317

Posted in: #Cpanel #Dns #Domains #Godaddy #Subdomain

I've researched and tried a lot of solutions online, but none seems to solve my problem, it seems something is missing.

I have domain registered at Godaddy, let's call it domain "X"
I have 2 servers with 2 different hosting companies (Server A and B)

Domain X nameservers point to Cloudflare's DNS which I have set up with my Server A. No problem there.

I want a subdomain (sub.X.com) to point to Server B which already has a website in it with a different domain (Domain "Y").

So I did what most people say:
Set up the A Record on Server A to point to Server's B IP address. However, all explanations end there, something seems missing, how can that subdomain know where are its files? I need to create an account for it on CPanel:

Now I go to CPanel on Server B and add an "Add-on Domain", which gives me an error (The domain's DNS I am trying to add do not match the current server's DNS). So ok, I add Server B's DNS to domain X in Godaddy

Now I have 4 different DNS registered at godaddy for the same domain (I added last 2):


cloudflare.dns1.com
cloufldare.dns2.com
serverB.dns1.com
serverB.dns2.com


I go to Server B's CPanel, and try to add a new "Add-on Domain", no error, now it lets me create it. I create the folder to host my subdomain files. So far everything works good. I go to "sub.X.com" on my web browser, it shows my website as expected. BUT now the problem is, when I visit "domain X" it shows an empty page (pointing to Server B, which is what I do not want; I want it to keep pointing to Server A), weird thing is, sometimes "domain X" loads as expected (pointed to Server A) and sometimes to Server B (blank page).

This is the point where It gets confusing, since I do not have much experience with DNS, and propagation time is a headache since I can't really see if what I'm doing works in real time.

Server B created some DNS zone "A records" after I created my "add-on domain", which have "domain X" pointed to server B's IP (Which should not be correct, since Server A also has an "A record" pointing to its own IP), so I figured deleting those records could solve the situation, but here's what I don't know what's happening, because sometimes "domain X" loads perfectly pointed to Server A, and sometimes, pointed to Server B.

What's the correct way to diagnose this?
is this the correct way to tackle this situation?
Should I keep on server B's CPanel ONLY the subdomain (sub.X.com) DNS records (and delete domain X records (CName, A, mail, ftp, etc)) ? Or is this problems just a matter of waiting for DNS and DNS config to propagate?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Kevin317

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cody1181609

Stephen's answer was correct, although I still needed to add the nameservers in Godaddy in order to add the "add-on domain" on Server B's cPanel, it was either that or edit /etc/ips.remotedns and add the nameservers; but since it's a shared hosting and they're not allowed to make that change, I had to do that "trick".

After I added the nameservers, I proceeded to add the "add-on domain" on Server's B to avoid the error. Then I removed the nameservers again in Godaddy to prevent my domain X from resolving to a blank page.

10% popularity Vote Up Vote Down


 

@Heady270

There are three entities involved in getting a site online for a domain name:


The domain registrar
The DNS host
The web host


For a domain and a subdomain you can have two web hosts, but you can still only have one DNS host.

It sounds like your web hosting accounts are each able to be your DNS host. You can choose only one of them to host all your DNS records.

Right now what is happening is that you are trying to add records from two DNS hosts to your domain register as name servers. That won't work. When you have four name server (NS) records listed, one of the four will randomly get chosen for each request. Some of the time one site will work, and some of the time the other site will work.

You need to ignore the DNS hosting ability of one of your two web hosts and add records to the other. I'm going to assume that you are going to use cloudflare for DNS. On your domain registrar you need to set the NS records to only cloudflare:

NS example.com cloudflare.dns1.com
NS example.com cloudflare.dns2.com


In cloud flare DNS manager you need to add the entries for both your main domain and your subdomain:

A example.com 2.2.2.2
A example.com 2.2.2.2
A sub.example.com 3.3.3.3
A sub.example.com 3.3.3.3


Where 2.2.2.2 is replaced by the IP address of Server A and 3.3.3.3 is replaced by the IP address of Server B.

Once you have this configuration in place on cloudflare, CPanel on server B should allow you to add the add-on domain.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme