How To Change Default Listen Port of Apache On Linux

How to change default listen Port on Apache configuration file. it’s very easy to do that you can run a website on different port also rather than the default port on Centos.

How To Change Default Listen Port of Apache:

By default, Apache listens on port 80 and you can change in the configuration file. you must have allowed the change port in the firewall. you can find the port available using the below commands and after making changes reload the apache service.

Check Out: How To Set Date and Time In Linux Using Command Line

We can also test the configuration file before reloading the service using httpd -t

Let’s check which port listening to which services

nmap -sT -O localhost

Change Default Listen Port

Check Out: Configure Varnish For Apache Web Server

Check whether Port 8000 is free or not.

lsof -i:8000

No output means this port is free.

apache default port

Add this port to the firewall

firewall-cmd --zone=public --permanent --add-port=8000/tcp

Reload the firewall to apply changes.

Check Out: How To Hide Apache Web Server Name

Add this port in apache configuration file located at /etc/httpd/conf/httpd.conf

Restart the Apache Service

systemctl restart httpd

Create a file at location /var/www/html/index.html

Now try to access the Website Page on the browser with IP:8000

http://192.168.140.141:8000/

You’re done change apache port centos

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment