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

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding 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 *