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.
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
Check Out: Configure Varnish For Apache Web Server
Check whether Port 8000 is free or not.
No output means this port is free.
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
You’re done change apache port centos