bind.html.en revision 59c15ce2922cf16717326159168f26f628345a82
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<?xml version="1.0" encoding="ISO-8859-1"?>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd This file is generated from xml source: DO NOT EDIT
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd -->
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<title>Binding - Apache HTTP Server</title>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<body id="manual-page"><div id="page-header">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<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>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<p class="apache">Apache HTTP Server Version 2.3</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<img alt="" src="/images/feather.gif" /></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div id="path">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<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/">Documentation</a> &gt; <a href="./">Version 2.3</a></div><div id="page-content"><div id="preamble"><h1>Binding</h1>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div class="toplang">
a34d44ce259e68932a3db730a7cb0d3edde46860kess<p><span>Available Languages: </span><a href="/de/bind.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
a34d44ce259e68932a3db730a7cb0d3edde46860kess<a href="/en/bind.html" title="English">&nbsp;en&nbsp;</a> |
43e2c3ca329ff3ca8cb7613d455ddb3794edf7adnd<a href="/fr/bind.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/ja/bind.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/ko/bind.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<a href="/tr/bind.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
a34d44ce259e68932a3db730a7cb0d3edde46860kess</div>
a34d44ce259e68932a3db730a7cb0d3edde46860kess
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>Configuring Apache HTTP Server to listen on specific addresses and ports.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#overview">Overview</a></li>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<li><img alt="" src="/images/down.gif" /> <a href="#ipv6">Special IPv6 Considerations</a></li>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<li><img alt="" src="/images/down.gif" /> <a href="#virtualhost">How This Works With Virtual Hosts</a></li>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd</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>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div class="section">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<h2><a name="overview" id="overview">Overview</a></h2>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <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>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>When httpd starts, it binds to some port and address on
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd the local machine and waits for incoming requests. By default,
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd it listens to all addresses on the machine. However, it may need to
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd be told to listen on specific ports, or only on selected
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd addresses, or a combination of both. This is often combined with the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <a href="vhosts.html">Virtual Host</a> feature, which determines how
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <code>httpd</code> responds to different IP addresses, hostnames and
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd ports.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>The <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd directive tells the server to accept
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd incoming requests only on the specified port(s) or
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd address-and-port combinations. If only a port number is
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd specified in the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd directive, the server listens to the given port on all interfaces.
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd If an IP address is given as well as a port, the server will listen
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd on the given port and interface. Multiple <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directives may be used to
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd specify a number of addresses and ports to listen on. The
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd server will respond to requests from any of the listed
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd addresses and ports.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>Overlapping <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd directives will result in a fatal error which will prevent the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd server from starting up.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>For example, to make the server accept connections on both
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd port 80 and port 8000, on all interfaces, use:</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <div class="example"><p><code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen 80<br />
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen 8000
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </code></p></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>To make the server accept connections on port 80 for one interface,
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd and port 8000 on another, use</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <div class="example"><p><code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen 192.0.2.1:80<br />
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen 192.0.2.5:8000
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </code></p></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>IPv6 addresses must be enclosed in square brackets, as in the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd following example:</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <div class="example"><p><code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen [2001:db8::a00:20ff:fea7:ccea]:80
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </code></p></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div class="section">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<h2><a name="ipv6" id="ipv6">Special IPv6 Considerations</a></h2>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>A growing number of platforms implement IPv6, and
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <a class="glossarylink" href="/glossary.html#apr" title="see glossary">APR</a> supports IPv6 on most of these platforms,
71fccc298df6a1540d408151a26aa22beed55d0bnd allowing httpd to allocate IPv6 sockets, and to handle requests sent
71fccc298df6a1540d408151a26aa22beed55d0bnd over IPv6.</p>
71fccc298df6a1540d408151a26aa22beed55d0bnd
71fccc298df6a1540d408151a26aa22beed55d0bnd <p>One complicating factor for httpd administrators is whether or
71fccc298df6a1540d408151a26aa22beed55d0bnd not an IPv6 socket can handle both IPv4 connections and IPv6
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd connections. Handling IPv4 connections with an IPv6 socket uses
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd IPv4-mapped IPv6 addresses, which are allowed by default on most
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd platforms, but are disallowed by default on FreeBSD, NetBSD, and
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd OpenBSD, in order to match the system-wide policy on those
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd platforms. On systems where it is disallowed by default, a
71fccc298df6a1540d408151a26aa22beed55d0bnd special <code class="program"><a href="/programs/configure.html">configure</a></code> parameter can change this behavior
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd for httpd.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>On the other hand, on some platforms, such as Linux and Tru64, the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <strong>only</strong> way to handle both IPv6 and IPv4 is to use
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd mapped addresses. If you want <code>httpd</code> to handle IPv4 and IPv6 connections
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd with a minimum of sockets, which requires using IPv4-mapped IPv6
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd addresses, specify the <code>--enable-v4-mapped</code> <code class="program"><a href="/programs/configure.html">configure</a></code> option.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p><code>--enable-v4-mapped</code> is the default on all platforms except
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd FreeBSD, NetBSD, and OpenBSD, so this is probably how your httpd was
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd built.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
71fccc298df6a1540d408151a26aa22beed55d0bnd <p>If you want httpd to handle IPv4 connections only, regardless of
71fccc298df6a1540d408151a26aa22beed55d0bnd what your platform and APR will support, specify an IPv4 address on all
71fccc298df6a1540d408151a26aa22beed55d0bnd <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directives, as in the
71fccc298df6a1540d408151a26aa22beed55d0bnd following examples:</p>
71fccc298df6a1540d408151a26aa22beed55d0bnd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <div class="example"><p><code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen 0.0.0.0:80<br />
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Listen 192.0.2.1:80
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </code></p></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p>If your platform supports it and you want httpd to handle IPv4 and
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd IPv6 connections on separate sockets (i.e., to disable IPv4-mapped
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd addresses), specify the <code>--disable-v4-mapped</code> <code class="program"><a href="/programs/configure.html">configure</a></code> option. <code>--disable-v4-mapped</code> is the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd default on FreeBSD, NetBSD, and OpenBSD.</p>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<div class="section">
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd<h2><a name="virtualhost" id="virtualhost">How This Works With Virtual Hosts</a></h2>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <p> The <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directive does not implement
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd Virtual Hosts - it only tells the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd main server what addresses and ports to listen on. If no
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd directives are used, the server will behave
a34d44ce259e68932a3db730a7cb0d3edde46860kess in the same way for all accepted requests. However,
a34d44ce259e68932a3db730a7cb0d3edde46860kess <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
43e2c3ca329ff3ca8cb7613d455ddb3794edf7adnd can be used to specify a different behavior
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd for one or more of the addresses or ports. To implement a
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd VirtualHost, the server must first be told to listen to the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd address and port to be used. Then a
35714556a25fceb7c9bf9c4e01791b2e2a4c27c3nd <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> section
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd should be created for the specified address and port to set the
6116c12fdd3ed06d388fe6572e50a22e9320dfa5nd behavior of this virtual host. Note that if the
<code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
is set for an address and port that the
server is not listening to, it cannot be accessed.</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/de/bind.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
<a href="/en/bind.html" title="English">&nbsp;en&nbsp;</a> |
<a href="/fr/bind.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a> |
<a href="/ja/bind.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="/ko/bind.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="/tr/bind.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2010 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>
<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>
</body></html>