How to change cpanel port through command line

WHM/cPanel is one of the commonly using control panel in web hosting industry. We already discussed about the cPanel installation on server and some other topics related with cPanel/WHM. The installation steps are quite simple for cpanel. You can refer this link for getting more details on cpanel installation “Install Cpanel on centos – step by step procedure“.

Default port numbers of cPanel and WHM

To access the WHM, cPanel, webmail etc cPanel has default port numbers. The default port numbers for cPanel and WHM are listed below:

cPanel : 2082/2083(ssl)
WHM : 2086/2087(ssl)

How to change cpanel port – Command line option?

Yes, it is possible to change the port number from its default value. The port value for cPanel is defined in the configuration file ‘/var/cpanel/cpanel.config’. You can edit the value from here. Please do follow the steps explained below:

1, SSH to server as root user.
2, Open the configuration file by using your favourite editor and change the port number.

vi /var/cpanel/cpanel.config

----------
port=2082
----------

:wq

After changing the port value, run the following commands for it to take effect:

# /usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings
# /etc/init.d/httpd restart

That’s it… 🙂

Related

1, How to change ftp port – cpanel
2, How to change the apache port via command line in cpanel

Post navigation

Arunlal A

Engineer. Linux enthusiast. Traveller. DevOps learner and practitioner. I enjoy working with Linux, DevOps, automation, and technology while exploring new places along the way. I use this space to share my experiences, learnings, experiments, and things I discover along the journey. Whether you're a seasoned DevOps professional or just getting started, let's connect, learn, and grow together. Happy coding, automating, and deploying!

3 thoughts on “How to change cpanel port through command line”

Leave a Reply

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