How to change Apache Port Number on a cPanel Server

How to change Apache Port Number on a cPanel Server

In this tutorial we can learn how to change Apache Port Number on a cPanel Server.

Apache is a widely-used web server that is distributed under “open source” license. By default, Apache uses port 80 and secure port 443. You can change the port through WHM or from the cli.

Follow the below Steps to change Apache port number through WHM.

1) Login to WHM through https://yourserverIP:2087

2) Go to ‘Tweak Settings’.

How to change Apache Port Number on a cPanel Server

 

3) Click on ‘System’ under ‘Tweak settings’.

4) In system menu, we can change both Apache and SSL port number. By default, the port number will be 80 and 443 respectively. You can select the radio button under the default port to change the port number. Now you can change the port number.

How to change Apache Port Number on a cPanel Server

 

5) Click on ‘Save’ button to make the changes.

How to change Apache Port Number on a cPanel Server

 

Change the port number from the cli

1) Before altering the cPanel configuration file just take a backup for it. Use the following command to take the backup of cPanel configuration file.

 # cp -a /var/cpanel/cpanel.config  /var/cpanel/cpanel.config-backup

2) Open cPanel configuration file.

# vi /var/cpanel/cpanel.config

change the below line

apache_port=0.0.0.80

to

apache_port=0.0.0.8080

3) Rebuild the Apache configuration after changing the port number.

# /scripts/rebuildhttpdconf

4) Restart both cPanel and apache

# service httpd restart

# service cpanel restart

5) Open the new port in server firewall.

# vi /etc/csf/csf.allow

You need to add the new port number in ‘Allow incoming TCP port’ and ‘Allow outgoing TCP port’.

6) Restart csf.

# csf -r

If you need any further assistance please contact our support department.

  • 0

How to Enable Plaintext Authentication in Dovecot?

How to Enable Plaintext Authentication in Dovecot? Dovecot is an IMAP or POP3 server for...

Install Apache Tomcat using EasyApache4

Install Apache Tomcat using EasyApache4 The Apache Tomcat is an Apache module that provides a...

How to Enable Extended Logging in Exim

How to Enable Extended Logging in Exim The extended Exim logs in cPanel server will help you to...

Maximum number of connections from user+IP exceeded

Maximum number of connections from user+IP exceeded If you are getting an error like ‘ Error –...

How To Set Up Remote Access Key in WHM

How To Set Up Remote Access Key in WHM Remote Access Key is a cPanel feature that allows...