How to change primary domain

Operating system: CentOS 7
OS version: 7.8.2003 (core)

Hi, I have one question.

I have VPS (CentOS7) and Virtualmin installed years ago. Recently I have sold primary domain, and now I want to use another domain as primary (existing domain on my server). How to do that? Change hostname or there are some other configuration to do? I’m asking, before try anything because domain I want to use is working site and I don’t want to break something.

In short: oldhostname (sold), and now I would like to have mydomain.com to be primary.

Select a new domain and change Hostname on the server. Make sure to add DNS records as well. What was the Hostname you had?.. Then, go to Webmin, Networking, Network Config and change to new Hostname. BTW, try not to use a Domain you’re using for hosting sites. Preferably, use a New domain.

2 Likes

I agree with @ilouie: You’re better off using a domain that doesn’t also have a production site associated with it for the hostname, in part because it avoids situations like this one.

The server’s hostname doesn’t need to be catchy, memorable, nor anything else really. It just needs to be a FQDN that doesn’t have a bad reputation. I sometimes use the .net variant of the company that owns the server on a dedicated.

Once you change the hostname as already answered, you’ll also have to change the nameservers on all the domains hosted on the server if you’re using BIND, because your current nameservers belong to the domain you’re selling. You’ll have to create new ones, register them with the registrar of the hostname’s domain, and point all the domains to the new nameservers in the registrars holding those domains.

You can minimize (but not eliminate) downtime and client-side caching problems on the domain you’re selling by changing the TTL’s in the current DNS settings to something absurdly low like 300 or 600 for a week or two. It shouldn’t be as much of an issue on the rest because the host’s IP isn’t changing.

You’ll also have to correct the server’s rDNS once you make the change because the IP will no longer be associated with the hostname’s domain.

Richard

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.