● Configure httpd To Listen on Multiple Ports

How do I configure Apache HTTPD to listen on multiple ports under RHEL / Fedora / CentOS Linux Server?

Multiple ports can be configured via Listen directive under Apache web server. By default httpd listens on TCP port 80.

How to configure httpd to listen multiple ports?
Open configure file /etc/httpd/conf/httpd.conf and modify the Listen directive tells the server to accept incoming requests on the specified port. Multiple Listen directives may be used to specify a number of ports to listen to.

vi /etc/httpd/conf/httpd.conf

Find line that read as follows:
Listen 80

Force httpd to listen to port 81:
Listen 81

Force httpd to listen on both port 80 and 81:
Listen 80
Listen 81

Save and close the file. Restart httpd:

systemctl restart httpd

A note about SELinux

If you are using SELinux, make sure port 81 is configured and not blocked by SELinux. By default SELinux only allows port number 80 and 443 for httpd service. To display current port contexts, enter:

semanage port -l | grep http
semanage port -l | grep -w '^http_port_t'

Sample outputs:

http_port_t tcp 80, 443, 488, 8008, 8009, 8443

To add port 81 to port contexts, enter:

semanage port -a -t http_port_t -p tcp 81

You can verify new settings, enter:

semanage port -l | grep http_port_t

Sample outputs:

http_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443

Finally, reload or restart the httpd server, enter:

systemctl restart httpd

Permanently disable SELinux

vi /etc/sysconfig/selinux

Change SELinux = enforcing to SELinux = disabled.

Save and reboot server. Then you can use command sestatus to check SELinux status.

Refer to the article: