How to change apache port in cPanel Print

  • apache, cPanel, port, Linux, centos
  • 0

How to change apache port 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  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 directive.

[root@Cloudtechtiq #] 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:

[root@Cloudtechtiq #] /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.

[root@Cloudtechtiq #] /scripts/rebuildhttpdconf

By Gaurav Sharma

Thanks!


Was this answer helpful?

« Back