bind.xml revision 5f5d1b4cc970b7f06ff8ef6526128e9a27303d88
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync<!-- $LastChangedRevision$ -->
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Copyright 2002-2004 The Apache Software Foundation
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Licensed under the Apache License, Version 2.0 (the "License");
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync you may not use this file except in compliance with the License.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync You may obtain a copy of the License at
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Unless required by applicable law or agreed to in writing, software
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync distributed under the License is distributed on an "AS IS" BASIS,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync See the License for the specific language governing permissions and
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync limitations under the License.
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync <p>Configuring Apache to listen on specific addresses and ports.</p>
4237d5a79f48789aacc67dc43378d2d7813a39f4vboxsync <seealso><a href="vhosts/">Virtual Hosts</a></seealso>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <seealso><a href="dns-caveats.html">DNS Issues</a></seealso>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <modulelist>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync </modulelist>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directivelist>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directive module="core" type="section">VirtualHost</directive>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync </directivelist>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>When Apache starts, it binds to some port and address on
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync the local machine and waits for incoming requests. By default,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync it listens to all addresses on the machine. However, it needs to
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync be told to listen on specific ports, or to listen on only selected
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync addresses, or a combination. This is often combined with the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Virtual Host feature which determines how Apache responds to
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync different IP addresses, hostnames and ports.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>The <directive module="mpm_common">Listen</directive>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync directive tells the server to accept
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync incoming requests only on the specified port or
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync address-and-port combinations. If only a port number is
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync specified in the <directive module="mpm_common">Listen</directive>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync directive, the server
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync listens to the given port on all interfaces. If an IP address
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync is given as well as a port, the server will listen on the given
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync port and interface. Multiple <directive
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync module="mpm_common">Listen</directive> directives may be used to
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync specify a number of addresses and ports to listen on. The
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync server will respond to requests from any of the listed
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync addresses and ports.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>For example, to make the server accept connections on both
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync port 80 and port 8000, use:</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen 80<br />
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen 8000
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>To make the server accept connections on two specified
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync interfaces and port numbers, use</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen 192.170.2.1:80<br />
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen 192.170.2.5:8000
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>IPv6 addresses must be surrounded in square brackets, as in the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync following example:</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen [fe80::a00:20ff:fea7:ccea]:80
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>A growing number of platforms implement IPv6, and APR supports
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IPv6 on most of these platforms, allowing Apache to allocate IPv6
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync sockets and handle requests which were sent over IPv6.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>One complicating factor for Apache administrators is whether or
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync not an IPv6 socket can handle both IPv4 connections and IPv6
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync connections. Handling IPv4 connections with an IPv6 socket uses
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IPv4-mapped IPv6 addresses, which are allowed by default on most
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync platforms but are disallowed by default on FreeBSD, NetBSD, and
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync OpenBSD in order to match the system-wide policy on those
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync platforms. But even on systems where it is disallowed by default, a
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync special configure parameter can change this behavior for Apache.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>On the other hand, on some platforms such as Linux and Tru64 the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <strong>only</strong> way to handle both IPv6 and IPv4 is to use
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync mapped addresses. If you want Apache to handle IPv4 and IPv6 connections
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync with a minimum of sockets, which requires using IPv4-mapped IPv6
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync addresses, specify the <code>--enable-v4-mapped</code> <a
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync href="programs/configure.html">configure</a> option.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p><code>--enable-v4-mapped</code> is the default on all platforms but
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync FreeBSD, NetBSD, and OpenBSD, so this is probably how your Apache was
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>If you want Apache to handle IPv4 connections only, regardless of
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync what your platform and APR will support, specify an IPv4 address on all
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directive module="mpm_common">Listen</directive> directives, as in the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync following examples:</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen 0.0.0.0:80<br />
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Listen 192.170.2.1:80
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <p>If your platform supports it and you want Apache to handle IPv4 and
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync IPv6 connections on separate sockets (i.e., to disable IPv4-mapped
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync addresses), specify the <code>--disable-v4-mapped</code> <a
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync href="programs/configure.html">configure</a> option.
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <code>--disable-v4-mapped</code> is the default on FreeBSD,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync NetBSD, and OpenBSD.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync module="mpm_common">Listen</directive> does not implement
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync Virtual Hosts. It only tells the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync main server what addresses and ports to listen to. If no
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directive module="core" type="section">VirtualHost</directive>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync directives are used, the server will behave
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync the same for all accepted requests. However,
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directive module="core" type="section">VirtualHost</directive>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync can be used to specify a different behavior
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync for one or more of the addresses and ports. To implement a
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync VirtualHost, the server must first be told to listen to the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync address and port to be used. Then a
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directive module="core" type="section">VirtualHost</directive> section
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync should be created for a specified address and port to set the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync behavior of this virtual host. Note that if the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync <directive module="core" type="section">VirtualHost</directive>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync is set for an address and port that the
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync server is not listening to, it cannot be accessed.</p>
058c0c53c37f5cb271aeb3c385c10766f84f4aefvboxsync</manualpage>