How to change the port number of Apache Web Server?

Default port to access the Apache is 80. Secure port for communicating with world for Apache is 443. Very frequently, we need to update the Apache port. Here is procedure to update the Apache port number on Linux server.

Steps -

1. SSH to your server. Please make sure, you have root access to server. Without root access, you can not proceed with it. 

2. Now, you will need to update the Apache configuration file. Apache configuration file is present at this location -
/etc/httpd/conf/httpd.conf

You can use any file editor with which you are comfortable to update the file  -
vi /etc/httpd/conf/httpd.conf

3. Search for the listen value in Apache configuration file. You can use blow command to find it -
grep Listen /etc/httpd/conf/httpd.conf

Output will be as follow -
Listen 0.0.0.0:80  ---------------> This for non SSL port
Listen [::]:80

Listen 0.0.0.0:443----------------> This is for SSL port
Listen [::]:443

You can update the Listen value to the port number which you would like to update. 

4. Restart the Apache Service after updating the port number. You can use any of the below command to restart the service -
service httpd restart

OR
/etc/init.d/httpd restart

That's it!Smile Your website is ready to use using updated port number. 
  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

How to install AVG Antivirus scanner on Ubuntu?

AVG free is antivirus which protects from spyware as well malware. It is free to use for private...

How to setup a WordPress website on plain Centos server?

The following steps have been successfully tested on a plain centos server. Now lets start...

How to install Postfix on CentOS?

Postfix is an open-source Mail Transport Agent (MTA), which supports protocols like LDAP, SMTP...

How to install SOAP on CentOS?

Install SOAP on CentOS 1) Fire below command - yum install php-soap Output will be as follow...

How to update kernel on centos server?

Please follow below steps to update the kernel on centos server - 1. SSH of centos server and...

Powered by WHMCompleteSolution