: How to edit /etc/hosts file on WHM/cPanel I need to add a domain/IP record to my hosts file on a CentOS box running WHM/cPanel, so that a domain which has no public DNS is routed to the
I need to add a domain/IP record to my hosts file on a CentOS box running WHM/cPanel, so that a domain which has no public DNS is routed to the correct IP address.
I've done this on my macbook but I'm unsure of the process on cPanel.
When I nano /etc/hosts I see the following:
# Automatically generated by OnApp (2.3.1)
127.0.0.1 localhost
1.2.3.4 s1.mydomain.com
So - if the contents of this file are automatically generated:
Is it safe to edit this file manually - or will cPanel wipe my changes during updates etc?
Does WHM/cPanel have an GUI for adding hosts records?
More posts by @Moriarity557
2 Comments
Sorted by latest first Latest Oldest Best
It is perfectly acceptable to update /etc/hosts in cPanel/WHM.
As a rule of thumb, incase of an update which may change the file (unlikely, cPanel doesn't tend to touch it after the initial install phase) run this command to take a backup.
# cp /etc/hosts /etc/hosts.bak
This will copy your hosts file to a new file in your etc directory called hosts.bak which you can rename to hosts again at anytime incase you need to revert any changes.
At current, cPanel does not provide a GUI for updating your hosts file however, if this is a feature that you feel will benefit others, you can submit a feature request where others can vote on and discuss your request.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.