How to change the port number of Apache(web server) – Command line option for Linux server

Hi, we all know the default port for the Apache web-server. The Apache is using the port 80 to communicate with world. We already discussed about, how do we change the Apache port in a cPanel based server, click here to Change the Apache port via command line in cpanel

Here I am explaining the way to change the Apache port on your Linux server. The port number is defined in the configuration file of the Apache web-server. Do follow the steps to change the Apache port from command line.
Apache configuration file:

# /etc/httpd/conf/httpd.conf

Step 1 : SSH to your server as root user.
Step 2 : Open the Apache configuration file with your favorite file editor.

# vi /etc/httpd/conf/httpd.conf

And change the Listen Address value to your new port number.


# grep Listen /etc/httpd/conf/httpd.conf
Listen 0.0.0.0:80
Listen [::]:80
SSL port
Listen 0.0.0.0:443
Listen [::]:443

Step 3 : Restart the apache service to take this change live.

# service httpd restart
Or
# /etc/init.d/httpd restart

That’s it, then try to access your website with the port which you have selected for the Apache.

 

Related:
1, How to change ftp port – cpanel
2, How to change the ssh port in Linux servers – Command line option
3, How to reset SSH port from WHM
4, How to change the apache port via command line in cpanel
5, How to change cpanel port through command line
6, Important cPanel service’s configuration file, path, service name, port – Command line view
7, How to change Direct admin’s default port number
8, Port number for Direct admin
9, What port is webmin using and configuring your firewall for webmin
10, Change SSH port of a server having Webmin
11, How to open alternate SMTP port 26 on Plesk server

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *