Apache (Web Server) - Listen directive

by
Jeremy Canfield |
Updated: September 28 2021
| Apache (Web Server) articles
The Listen directive configures a web server instance to listen for HTTP and HTTPS connections on one or more ports. In this example, the web server instance will listen on port 80.
Listen 80
When you have two or more web server instances on a single server, one option is to give each instance it's own unique port.
# instance "a"
Listen 80
# instance "b"
Listen 8080
Or, both instances could listen on port 80 by assigning different IP addresses to each instance, assuming the server has these IP addresses bound to the network interface.
# instance "a"
Listen 10.15.225.14:80
# instance "b"
Listen 10.15.225.15:80
Or, hostnames can be used, assuming the hostnames are resolves to the approriate IP addresses bound to the network interface.
# instance "a"
Listen server1.example.com:80
# instance "b"
Listen server2.example.com:80
Did you find this article helpful?
If so, consider buying me a coffee over at