To configure the Apache HTTP Server (HTTPD) to listen on multiple ports, you can use the Listen
directive in the httpd.conf
configuration file. The Listen
directive specifies the IP address and port that the server should listen on.
For example, to configure HTTPD to listen on the default HTTP port (80) and the default HTTPS port (443), you can add the following lines to the httpd.conf
file:
Listen 80 Listen 443
To listen on additional ports, you can add additional Listen
directives. For example, to listen on port 8080 and 8443, you can add the following lines:
Listen 8080 Listen 8443
You will also need to ensure that the ports you are listening on are open in the firewall and allowed through any other security measures, such as a firewall or security group.
After making changes to the httpd.conf
file, you will need to restart the HTTPD service for the changes to take effect. You can do this using the following command:
sudo systemctl restart httpd
Note: If you are using a version of HTTPD that is older than version 2.4, you will need to use the
NameVirtualHost
directive instead of theListen
directive to specify the IP address and port that the server should listen on.
For example:
NameVirtualHost *:80 NameVirtualHost *:443