bind.html.en revision 35618dd145853155d4c7b1d0d6391707315f957e
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<?xml version="1.0" encoding="ISO-8859-1"?>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
acc36ab93565d2880447d535da6ca6e5feac7a70nd This file is generated from xml source: DO NOT EDIT
acc36ab93565d2880447d535da6ca6e5feac7a70nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding -->
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<title>Binding - Apache HTTP Server</title>
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding<link href="/images/favicon.ico" rel="shortcut icon" /></head>
acc36ab93565d2880447d535da6ca6e5feac7a70nd<body id="manual-page"><div id="page-header">
acc36ab93565d2880447d535da6ca6e5feac7a70nd<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
acc36ab93565d2880447d535da6ca6e5feac7a70nd<p class="apache">Apache HTTP Server Version 2.1</p>
acc36ab93565d2880447d535da6ca6e5feac7a70nd<img alt="" src="/images/feather.gif" /></div>
acc36ab93565d2880447d535da6ca6e5feac7a70nd<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
acc36ab93565d2880447d535da6ca6e5feac7a70nd<div id="path">
acc36ab93565d2880447d535da6ca6e5feac7a70nd<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="./">Version 2.1</a></div><div id="page-content"><div id="preamble"><h1>Binding</h1>
acc36ab93565d2880447d535da6ca6e5feac7a70nd<div class="toplang">
acc36ab93565d2880447d535da6ca6e5feac7a70nd<p><span>Available Languages: </span><a href="/de/bind.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
acc36ab93565d2880447d535da6ca6e5feac7a70nd<a href="/en/bind.html" title="English">&nbsp;en&nbsp;</a> |
7db9f691a00ead175b03335457ca296a33ddf31bnd<a href="/fr/bind.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<a href="/ja/bind.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<a href="/ko/bind.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
654d8eb036bedc99e90e11910ee02d3421417697rbowen <p>Configuring Apache to listen on specific addresses and ports.</p>
654d8eb036bedc99e90e11910ee02d3421417697rbowen </div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#overview">Overview</a></li>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<li><img alt="" src="/images/down.gif" /> <a href="#ipv6">Special IPv6 Considerations</a></li>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<li><img alt="" src="/images/down.gif" /> <a href="#virtualhost">How This Works With Virtual Hosts</a></li>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</ul><h3>See also</h3><ul class="seealso"><li><a href="vhosts/">Virtual Hosts</a></li><li><a href="dns-caveats.html">DNS Issues</a></li></ul></div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<div class="section">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<h2><a name="overview" id="overview">Overview</a></h2>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="/mod/core.html">core</a></code></li><li><code class="module"><a href="/mod/mpm_common.html">mpm_common</a></code></li></ul></td><td><ul><li><code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code></li><li><code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code></li></ul></td></tr></table>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>When Apache starts, it binds to some port and address on
6da407b2e43a613ec833f14d8c05d4494a27f17aslive the local machine and waits for incoming requests. By default,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive it listens to all addresses on the machine. However, it needs to
654d8eb036bedc99e90e11910ee02d3421417697rbowen be told to listen on specific ports, or to listen on only selected
6da407b2e43a613ec833f14d8c05d4494a27f17aslive addresses, or a combination. This is often combined with the
f629fd8f821ed20d16d76733bc19bf5480986220slive Virtual Host feature which determines how Apache responds to
f629fd8f821ed20d16d76733bc19bf5480986220slive different IP addresses, hostnames and ports.</p>
f629fd8f821ed20d16d76733bc19bf5480986220slive
f629fd8f821ed20d16d76733bc19bf5480986220slive <p>The <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
f629fd8f821ed20d16d76733bc19bf5480986220slive directive tells the server to accept
f629fd8f821ed20d16d76733bc19bf5480986220slive incoming requests only on the specified port or
f629fd8f821ed20d16d76733bc19bf5480986220slive address-and-port combinations. If only a port number is
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen specified in the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
4c291e02d98a08f4d39944dd30621f1930f92268rbowen directive, the server
6da407b2e43a613ec833f14d8c05d4494a27f17aslive listens to the given port on all interfaces. If an IP address
6da407b2e43a613ec833f14d8c05d4494a27f17aslive is given as well as a port, the server will listen on the given
6da407b2e43a613ec833f14d8c05d4494a27f17aslive port and interface. Multiple <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directives may be used to
6da407b2e43a613ec833f14d8c05d4494a27f17aslive specify a number of addresses and ports to listen on. The
6da407b2e43a613ec833f14d8c05d4494a27f17aslive server will respond to requests from any of the listed
6da407b2e43a613ec833f14d8c05d4494a27f17aslive addresses and ports.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>For example, to make the server accept connections on both
6da407b2e43a613ec833f14d8c05d4494a27f17aslive port 80 and port 8000, use:</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <div class="example"><p><code>
b20a53da22140b5a3d221a19a12142f89f1b606drjung Listen 80<br />
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Listen 8000
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </code></p></div>
b20a53da22140b5a3d221a19a12142f89f1b606drjung
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>To make the server accept connections on two specified
6da407b2e43a613ec833f14d8c05d4494a27f17aslive interfaces and port numbers, use</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
f629fd8f821ed20d16d76733bc19bf5480986220slive <div class="example"><p><code>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Listen 192.170.2.1:80<br />
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Listen 192.170.2.5:8000
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </code></p></div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>IPv6 addresses must be surrounded in square brackets, as in the
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf following example:</p>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <div class="example"><p><code>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf Listen [fe80::a00:20ff:fea7:ccea]:80
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf </code></p></div>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf<div class="section">
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf<h2><a name="ipv6" id="ipv6">Special IPv6 Considerations</a></h2>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <p>A growing number of platforms implement IPv6, and APR supports
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf IPv6 on most of these platforms, allowing Apache to allocate IPv6
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf sockets and handle requests which were sent over IPv6.</p>
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf <p>One complicating factor for Apache administrators is whether or
954857c6508d60fd4e0a8c304698b25a15adbf33poirier not an IPv6 socket can handle both IPv4 connections and IPv6
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf connections. Handling IPv4 connections with an IPv6 socket uses
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf IPv4-mapped IPv6 addresses, which are allowed by default on most
954857c6508d60fd4e0a8c304698b25a15adbf33poirier platforms but are disallowed by default on FreeBSD, NetBSD, and
d3a52d99691581fffaf2a375a80808d943807189poirier OpenBSD in order to match the system-wide policy on those
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf platforms. But even on systems where it is disallowed by default, a
cba8c0896ba04d42cf9a9e50df5040fd6bae14a4sf special configure parameter can change this behavior for Apache.</p>
bc91276d454cab5923b4a0fcf94931bd0a6bee34poirier
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>On the other hand, on some platforms such as Linux and Tru64 the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <strong>only</strong> way to handle both IPv6 and IPv4 is to use
6da407b2e43a613ec833f14d8c05d4494a27f17aslive mapped addresses. If you want Apache to handle IPv4 and IPv6 connections
6da407b2e43a613ec833f14d8c05d4494a27f17aslive with a minimum of sockets, which requires using IPv4-mapped IPv6
6da407b2e43a613ec833f14d8c05d4494a27f17aslive addresses, specify the <code>--enable-v4-mapped</code> <a href="programs/configure.html">configure</a> option.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p><code>--enable-v4-mapped</code> is the default on all platforms but
6da407b2e43a613ec833f14d8c05d4494a27f17aslive FreeBSD, NetBSD, and OpenBSD, so this is probably how your Apache was
6da407b2e43a613ec833f14d8c05d4494a27f17aslive built.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>If you want Apache to handle IPv4 connections only, regardless of
6da407b2e43a613ec833f14d8c05d4494a27f17aslive what your platform and APR will support, specify an IPv4 address on all
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directives, as in the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive following examples:</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <div class="example"><p><code>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Listen 0.0.0.0:80<br />
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Listen 192.170.2.1:80
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </code></p></div>
4c291e02d98a08f4d39944dd30621f1930f92268rbowen
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <p>If your platform supports it and you want Apache to handle IPv4 and
6da407b2e43a613ec833f14d8c05d4494a27f17aslive IPv6 connections on separate sockets (i.e., to disable IPv4-mapped
199a8ee5984e3708982fab1ba6ebb0a5feaea90cnd addresses), specify the <code>--disable-v4-mapped</code> <a href="programs/configure.html">configure</a> option.
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <code>--disable-v4-mapped</code> is the default on FreeBSD,
6da407b2e43a613ec833f14d8c05d4494a27f17aslive NetBSD, and OpenBSD.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<div class="section">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<h2><a name="virtualhost" id="virtualhost">How This Works With Virtual Hosts</a></h2>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
6da407b2e43a613ec833f14d8c05d4494a27f17aslive
4c291e02d98a08f4d39944dd30621f1930f92268rbowen <p> <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> does not implement
6da407b2e43a613ec833f14d8c05d4494a27f17aslive Virtual Hosts. It only tells the
1b6d7a3923d2a5cd56970ee9c4389fddd2e402e6kess main server what addresses and ports to listen to. If no
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen directives are used, the server will behave
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen the same for all accepted requests. However,
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive can be used to specify a different behavior
6da407b2e43a613ec833f14d8c05d4494a27f17aslive for one or more of the addresses and ports. To implement a
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen VirtualHost, the server must first be told to listen to the
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen address and port to be used. Then a
79d3110b294be95d91c9dc9218fb5cfa7f7f5090rbowen <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> section
6da407b2e43a613ec833f14d8c05d4494a27f17aslive should be created for a specified address and port to set the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive behavior of this virtual host. Note that if the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive is set for an address and port that the
6da407b2e43a613ec833f14d8c05d4494a27f17aslive server is not listening to, it cannot be accessed.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive </div></div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<div class="bottomlang">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<p><span>Available Languages: </span><a href="/de/bind.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<a href="/en/bind.html" title="English">&nbsp;en&nbsp;</a> |
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<a href="/fr/bind.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<a href="/ja/bind.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<a href="/ko/bind.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</div><div id="footer">
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
6da407b2e43a613ec833f14d8c05d4494a27f17aslive</body></html>