Hostname change in WHM

Hostname change in WHM post thumbnail image

Hostname change in WHM (Web Host Manager) is a crucial task, as it helps identify your server on the network and can affect various aspects of your web hosting environment.

Whether you’re running a shared hosting environment, a dedicated server, or a virtual private server (VPS), updating the hostname to something that reflects your domain or server’s purpose is essential for maintaining a professional and well-organized hosting environment.

Here’s a detailed, step-by-step guide to changing the hostname in WHM, along with considerations, troubleshooting, and the impact of changing the hostname:

What is a Hostname?

A hostname is the name assigned to a device on a network, allowing it to be identified. In the context of a web server, the hostname is important because:

  • It is used to identify the server on the internet and within your network.
  • It can be used in mail headers and server logs.
  • It helps in system administration tasks like monitoring, backups, and DNS records. A typical hostname is something like server1.example.com. It should always include a fully qualified domain name (FQDN).

Pre-Requisites and Considerations

Before changing the hostname, consider the following:

  • DNS Settings: Ensure that the new hostname is properly set up in your DNS records. It should have an A record pointing to your server’s IP address.
  • Email Deliverability: A hostname change can affect email services. Ensure that the new hostname matches the reverse DNS (rDNS) of your server’s IP address to prevent emails from being marked as spam.
  • SSL Certificates: If you use SSL certificates for your hostname, they will need to be reissued or updated after the hostname change.
  • Licensing: Some software licenses are tied to the hostname, and changing it could affect those licenses. You may need to re-validate them after the change.

Step-by-Step Guide to Changing the Hostname in WHM

1. Log in to WHM

  • Access your WHM control panel by navigating to the URL https://your-server-ip:2087.
  • Log in with your root or administrative credentials.

2. Locate the Hostname Change Section

  • From the WHM dashboard, type “Hostname” into the search bar at the top left or navigate through the following path:
    • Home -> Networking Setup -> Change Hostname.

3. View Current Hostname

  • Once you’re in the “Change Hostname” interface, you’ll see the current hostname at the top of the screen.
    • For example, it may look like oldhostname.example.com.

4. Set the New Hostname

  • Scroll down to the “New Hostname” field and enter your new desired hostname. Remember, it must be a fully qualified domain name (FQDN) and should follow the correct format:
    • Hostname Requirements:
      • Must be a valid domain name format (e.g., server1.example.com).
      • Cannot contain underscores (_).
      • Should not be an IP address.
      • Must consist of at least two periods (as it is fully qualified).
  • Example: newserver.example.com.

5. Check for DNS Resolution

  • Once you enter the new hostname, WHM will automatically perform a DNS resolution check to ensure that it’s properly configured in DNS. If the hostname is valid and resolves to your server, you will be allowed to proceed.
    • If the hostname does not resolve, ensure that you’ve added an A record for it in your DNS zone file.

6. Change the Hostname

  • Click the “Change” button to confirm the new hostname.
  • WHM will now apply the hostname change, and this process might take a few seconds to complete.

7. Restarting Services

  • After changing the hostname, WHM will prompt you to restart services to apply the changes. This typically includes services like Exim, Apache, and cPanel. You can either choose to manually restart the services or let WHM handle it.

8. Verify the Change

  • To ensure the hostname change was successful, log in via SSH and run the following command:Copy codehostname This command should return your new hostname.
  • Additionally, you can confirm the hostname change in the WHM interface by navigating back to Home -> Networking Setup -> Change Hostname, where your new hostname should now appear.

Updating Reverse DNS (rDNS)

To ensure smooth email delivery and to avoid emails being flagged as spam, your server’s reverse DNS (rDNS) should match the new hostname.

  1. Log in to your DNS provider’s control panel or contact your hosting provider.
  2. Find the reverse DNS or PTR record section.
  3. Update the PTR record to point to the new hostname.

SSL Certificates and Hostname Changes

If you’re using an SSL certificate associated with your server’s hostname (such as for mail services), you will need to update or reissue the certificate to reflect the new hostname.

Steps:

  1. Log into WHM -> Home -> SSL/TLS -> Manage SSL Hosts.
  2. Reissue the certificate by generating a new CSR (Certificate Signing Request) for the new hostname.
  3. Install the new SSL certificate via the WHM interface or by using a third-party tool if you’re not using AutoSSL.

Updating Other Configuration Files

Sometimes, changing the hostname might not update all configurations, especially if they were manually set. You may need to manually edit the following files:

  1. /etc/hostname: This file contains the system’s current hostname.
    • Command:bashCopy codenano /etc/hostname Make sure it contains the new hostname.
  2. /etc/hosts: The /etc/hosts file may still contain the old hostname. Update it accordingly.
    • Command:bashCopy codenano /etc/hosts
    • Ensure the line with your server’s IP address matches the new hostname, like so:Copy code127.0.0.1 localhost 123.45.67.89 newhostname.example.com newhostname

Common Issues and Troubleshooting

  1. Hostname doesn’t resolve in DNS:
    • If the hostname does not resolve properly, ensure that the DNS settings are correct and that the hostname has a corresponding A record.
  2. Emails marked as spam:
    • This could be due to an rDNS mismatch or missing SPF/DKIM records. Make sure that the reverse DNS and hostname match, and configure email authentication protocols properly.
  3. SSL Certificate issues:
    • If you notice SSL certificate errors after changing the hostname, reissue or install a new SSL certificate for the new hostname.
  4. Licensing problems:
    • Some server licenses (e.g., for cPanel, CloudLinux, etc.) are tied to the hostname. You may need to revalidate these licenses with your provider.

Conclusion

Changing the hostname in WHM is a relatively straightforward process but requires careful attention to DNS settings, email deliverability, and SSL certificates.

By following the steps outlined above and verifying that DNS and reverse DNS records are correctly configured, you can successfully update your server’s hostname without disrupting essential services.

Ensure that all associated services and configurations are updated to reflect the hostname change, and keep an eye on email and web service functionality after the hostname change to address any issues that might arise.

Related Post