Question
How to change or get a server hostname on the Plesk server?
Answer
Note: A server hostname must be a fully qualified domain name (FQDN). Changes are not instant. It requires 24-48 hours to get a new hostname propagated through all the DNS servers.
Warning: Server providers might deny hostname change, in such cases contact the server provider.
In Plesk interface
-
Go to the menu Tools & Settings > Server Settings, specify the new hostname in the field Full hostname and click OK at the bottom of the page to apply the changes**:**
Note: You should be logged in as the Plesk administrator to be able to see or change the hostname.
- Apply SSL certificate to Plesk (if it is needed) as instructed in the article How to secure a Plesk hostname.
Via CLI (Linux only)
-
Connect to the server using SSH as root.
-
To view hostname, execute the command:
# hostname
-
To change server hostname, execute the following command with preferred hostname value instead of host.example.com:
# plesk bin server_pref --update -hostname host.example.com
Alternatively, the native SystemD utility(CentOS7/Debian8+/Ubuntu16) can be used:
# hostnamectl set-hostname host.example.com
-
Restart services
sw-cp-server
andsw-engine
:# service sw-cp-server restart
# service sw-engine restart -
If it is needed, apply SSL certificate to Plesk
Note: In some cases, server restart is required.
For Google Cloud instance the changes will not be saved after server restart. Use the following workaround: https://cloud.google.com/compute/docs/instances/custom-hostname-vm.