Configuring Apache to listen on specific addresses and ports.
When Apache starts, it binds to some port and address on the local machine and waits for incoming requests. By default, it listens to all addresses on the machine. However, it needs to be told to listen on specific ports, or to listen on only selected addresses, or a combination. This is often combined with the Virtual Host feature which determines how Apache responds to different IP addresses, hostnames and ports.
The
For example, to make the server accept connections on both port 80 and port 8000, use:
To make the server accept connections on two specified interfaces and port numbers, use
IPv6 addresses must be surrounded in square brackets, as in the following example:
When APR supports IPv6, Apache will create IPv6-capable listening sockets by default (i.e., when no IP address is specified on the Listen directive). In other words, when APR supports IPv6,
is equivalent to
When APR does not support IPv6,
is equivalent to
On some platforms, such as NetBSD, binding to the IPv6 wildcard address ("::") does not allow Apache to accept connections on IPv4 interfaces. In this situation, multiple Listen directives are required, as shown below:
Apache does not currently detect this, so the Listen statements must be edited manually by the administrator.
Listen does not implement Virtual Hosts. It only tells the
main server what addresses and ports to listen to. If no