Setup cPanel to handle DNS locally, instead of Digital Ocean do it

November 2, 2016 176 views
DNS CentOS

Hello. I am trying to setup cPanel to handle multidomains, including my primary domain (eg. mydomain.com), but seems that I need tell to Digital Ocean / domains page all domains and subdomains that I need access. It is annoying and I too have an additional issue on primary domain.

What I need is that cPanel handle all DNS locally, instead of put this responsability to Digital Ocean / domains. So if I call www.mydomain.com, it should check on cPanel if www is registered to mydomain.com, and not on Digital Ocean / domains.

What happen: I have a mydomain.com registered on Digital Ocean / domains, with this following settings:

A @ {floatting IP}
NS ns1.digitalocean.com
NS ns2.digitalocean.com
NS ns3.digitalocean.com

It allow me to access my cPanel on mydomain.com:2087 correctly, and I can login normally too. Inside cPanel, I setup my hostname as server.mydomain.com, then I could create an account to mydomain.com to setup it contents.

But, when I access mydomain.com, it send me to cPanel 404 not found error.

1 Answer

In general with cPanel it's recommended not to use external DNS servers. What you'll usually want to do is:

1.) Decide whether to run a secondary DNS server. This is usually a good idea for redundancy but if your sites are all hosted on just the one server that is running your DNS it's less of a problem. If you do want to use a secondary DNS server you can likely use a smaller droplet for it and cPanel/WHM offers a free DNS only license for this purpose so there is no need for a second full cPanel license.

2.) Register your nameservers. With your domain registrar you can register your own nameservers (ns1.yourdomain.com, etc). This is in a seperate place from managing normal DNS records or pointing your domain to someone else's nameservers, if you have trouble finding it, ask your registrar. You can then create nameservers pointing to your droplet(s).

3.) Point your domain to your newly create nameservers.

Now, cPanel will be able to manage all your DNS settings internally. One great thing about using a paid control panel like cPanel is that they provide really good support and can assist you with the cPanel side of this setup. This is the standard, recommended way to use cPanel with DNS so once it's set up you should be all set.

  • Thanks for reply.

    On my registrar I setup mydomain.com to ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com. There an option to I point it to ns1.mydomain.com and set my float ip on it, but I don't know if it can solve my problem (I tried but nothing).

    I don't get the third topic, should I have two domains to make it work? I like to use a single domain to manager DNS as ns1.mydomain.com to all other domains, but I like to use mydomain.com as a site too.

    • You'll only need one domain. Basically you have two options when running a cPanel server on DO:

      1.) use the DO nameservers. For this you'll have your domain pointed as it is at ns1/2/3.digitalocean.com and you'll have to create your DNS records yourself through the DigitalOcean control panel.

      2.) Register ns1/2.yourdomain.com with your domain registrar (if you let me know where you registered the domain I can likely find you a guide for doing this). When registering these you'll point them directly to your droplet's IP. Your droplet, with cPanel would then also be your DNS server and cPanel/WHM would take care of all the heavy lifting of creating records.

      • Right. I'm using registro.br as registrar. But on droplet I have only one IP, and when I setup ns2 it requires an alternative IP that I haven't.

        So I have this condition:

        • If I register only ns1 to my unique droplet IP, I get this error: DNS server for Slave 1 not defined.
        • If I register ns2 with same IP from ns1, I get this error: DNS server for Slave 1 is duplicated from Master

        My last option is to use my direct droplet IP as secondary, but I don't like to do that, because of the floating IP feature.

        • Ok. Yeah, the two options you will have would be:

          1.) Use your droplet's ipv4 and a floating IP as the two
          2.) Create a second small droplet and install the cPanel DNS only version on it, then use that as your secondary.

          The reason for two servers is redundancy and some registrars will not allow duplicate IPs as appears to be the case with registro.br.

          • Thanks a lot. After the propagation, seems that all works now. Except that a subdomain account don't is work propertly, but it's another subject. For now I will try solve it alone, else I should contact cpanel support for this case. Thanks a lot!

Have another answer? Share your knowledge.