How to change the apache port via command line in cpanel

The default port value for the Apache web server running under the cPanel based server is 80. For some strange situations we need to change the default port value to something else.

How to change the apache port via command line in cpanel?
In c cPanel based server the port value for the web server apache is defined in the configuration file ‘/var/cpanel/cpanel.config‘. You can edit the default value from here. Please do the following steps to do the same.
Step 1: Open the configuration file by using your favorite editor and find the directive ‘apache_port’. You can change the value from this direcyive.

[[email protected] #] vim /var/cpanel/cpanel.config
------
apache_port:0.0.0.0:80
------

Where 80 is the default port value. You can change it to your own custom value.
Step 2: Run this script for it to take effect:

[[email protected] #] /usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

Check the httpd conf file ‘/usr/local/apache/conf/httpd.conf’ for finding any occurrences of default port (80) and run the following script to make httpd conf is up to date.

[[email protected] #] /scripts/rebuildhttpdconf 

Thanks…

Similar topic : How to change cpanel port through command line

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

4 Responses

  1. junior Hallak says:

    Thanks there, I made all process but do not work .

    I changed the port 80 to 8080 but when i run the command( /usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings ) said: “You haven’t licence cpanel “.

    Okay, I know, but is possible make this without license cpanel ?

    thanks !

  1. December 28, 2013

    […] Related links: How to enable mod_deflate in apache How to disable ‘Directory listing’ in Apache web server? How to change the apache port via command line in cpanel […]

  2. January 3, 2014

    […] Related links: How to reset SSH port from WHM How to change cpanel port through command line How to change the apache port via command line in cpanel […]

  3. January 20, 2014

    […] Links: How to change cpanel port through command line How to change the apache port via command line in cpanel How to change ftp port – […]

Leave a Reply

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