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