Default port to access the Apache is80. Secure port for communicating with world for Apache is443. 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 fileis present at this location -
/etc/httpd/conf/httpd.conf
You can use any file editorwith which you are comfortable to update the file -
vi/etc/httpd/conf/httpd.conf
3. Search for thelisten valuein Apache configuration file. You can use blow command to find it -
grep Listen /etc/httpd/conf/httpd.conf
Outputwill 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 theListen valueto the port number which you would like to update.
4.Restartthe Apache Service after updating the port number. Youcan use any of the below command to restart the service -
service httpd restart
OR
/etc/init.d/httpd restart
That's it!Your website is ready to useusing updated port number.