cPanel & WHM

Virtuozzo cPanel VPS hostname keeps changing

Your server must have an FQDM setup as its hostname. An FQDM (Fully Qualified Domain Name) will consist of two words and two full stops. Something like server.first2host.co.uk would be an FQDM whereas just server would be an invalid choice.

cPanel will use your hostname to send mail unless you have set up your server to send email via each account’s dedicated IP address. Not only mail, cPanel will also deploy SSL certificates to your server so you do not see any security warnings when logging in.

cPanel VPS Hostname Changing

If you run a Virtuozzo cPanel VPS Server, formally OpenVZ then some settings on the hostnode can mean when you reboot your server your hostname will revert back to a single word. This will cause errors you’re your cPanel server and this needs to be addressed urgently. If your cPanel VPS hostname is changing. Follow this guide.

If your cPanel server’s hostname keeps changing then first check the configuration file for the server. The configuration file is usually located at

/etc/vz/conf/CTID.conf

Find the CTID of the server that is having the hostname issues and inspect the configuration file by issuing

cat /etc/vz/conf/9999.conf

Set Correct Hostname

Look for the hostname= value and ensure the hostname is correct. If the hostname is what it should be then you will need to edit a file on the hostnode to stop Virtuozzo from making changes to the hostname on servers.

Open the file /etc/vz/dists/scripts/redhat-set_hostname.sh

nano /etc/vz/dists/scripts/redhat-set_hostname.sh

Find the line that states

echo "$val" > /etc/hostname

And in front of this line place a comment. “#”

# echo "$val" > /etc/hostname
cpanel vps hostname changing

Next, save the file and set the hostname in the VPS server that keeps reverting back to a single word. Reboot that server from the command line

vzctl restart 9999

When you login to the VPS Server next you should see that the hostname has not changed at all and is still set to what you set it to before you rebooted the server.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button