GICT knowledge base
How to change Apache Port Number on a cPanel Server
Published
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’.
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.
5) Click on ‘Save’ button to make the changes.
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.
Related guides
How to Install and Uninstall JetBackup for cPanel
How to Install JetBackup for cPanel. JetBackup is one of the leading backup solutions for cPanel & WHM that offers a user-friendly GUI. It provides
WHMSetup SendGrid on your cPanel VPS/Server
Setup SendGrid on your cPanel VPS/Server. SendGrid provides a cloud-based service for reliable transactional and marketing email.
WHMChange cPanel Nameserver Software to PowerDNS Carefully
Review WHM nameserver selection, resolver dependencies, cluster compatibility and DNSSEC requirements before a planned PowerDNS service change.
WHMTroubleshooting Jailed Shell on OpenVZ
cPanel/WHM providing Jailed shell environment for users, this feature giving high-level security for users when doing ssh access to their server.



