Q. Change the port number of Apache web server in Linux and Unix?

When ever a network service is started it starts listening on particular port. For example DNS server listen on 53 UDP and TCP port and Telnet server listen on 23 port. For more service and port mapping for different Linux service please click here

Some times we have to change the port for some services such as Apache so that they start listening on the port.

To change the port of Apache we have to edit httpd.conf which is located in /etc/httpd/conf in most Linux distributions. Open httpd.conf file and search for the word Listen. This Listen entry is to inform Apache where to listen for incoming http packets so that Apache can start processing the http packets.

Now change the port assigned to what ever port you want.

Listen <port>

Changing the port to 443 in httpd.conf file.

Listen 443

Once you edited the httpd.conf file save and exit it.

Start the Apache service to take this change live. Now try to access website with mention port.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.