Steps to change Apache port number

kumkumsharma

Administrator
Staff member
Secure port for connecting Apache webserver is 443. If you want to change default Apache port from 80 then you can follow below steps:
  • Login to your server with root access.
You cannot perform this operation without root access. Now we have to update Apache configuration file which is available at /etc/httpd/conf/httpd.conf location.

We are here using vi editor to update this file, you can use any other editor.

Code:
vi /etc/httpd/conf/httpd.conf
  • You can search with grep command to find value:
Code:
grep Listen /etc/httpd/conf/httpd.conf
Output will be this:-

Code:
Listen 0.0.0.0:80 ---------------> This for non SSL port
Listen [::]:80
Code:
Listen 0.0.0.0:443----------------> This is for SSL port
Listen [::]:443
You can enter the value which you want to update.
  • Now restart Apache with below command:
Code:
service httpd restart
OR
/etc/init.d/httpd restart
 
Top