I have many sites (each one with its own domain) all on the same cPanel hosted server (let's say server IP is 1.1.1.1
and server main domain is myserver.com
)
All these domains use third party DNS (not the cPanel hosted ones), I set up the DNS of each one of these domain to point to server IP. Example of how each domain DNS is currently set:
domainx.com -> A -> 1.1.1.1
domainx.com -> MX -> mail.domainx.com
mail.domainx.com -> A -> 1.1.1.1
www.domainx.com -> CNAME -> domainx.com
ftp.domainx.com -> CNAME -> domainx.com
This situation obliges me to repeat hundreds times the server IP 1.1.1.1
one time for each domain. In the event that server IP changes I will have to go through each domain DNS to update records with new IP.
So I thought why not use CNAME to avoid rewriting server IP everywhere?! I could set each domain DNS like the following:
domainx.com -> CNAME -> myserver.com
domainx.com -> MX -> mail.myserver.com
mail.domainx.com -> CNAME -> myserver.com
www.domainx.com -> CNAME -> myserver.com
ftp.domainx.com -> CNAME -> myserver.com
But I read that domainx.com -> CNAME -> myserver.com
is evil, see this and this.
But what alternatives do I have to avoid rewriting server IP everywhere?
Best Answer
CNAMEs are not evil. However using CNAMES for a second level domain will break DNS for those domains. You cannot add MX, TXT or just about any other records at the same level as the CNAME record. From rfc1912:
Technically this might work, but mixing CNAMES with other records may confuse other DNS servers, which is going to cause to cause strange failures and will be an administrative headache.