bind.html.en revision 2a0b626c070fea0a68a071a4160ff695eb4731da
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.1</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-project/">Documentation</a> &gt; <a href="./">Version 2.1</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="/es/bind.html" hreflang="es" rel="alternate" title="Espa�ol">&nbsp;es&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></p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes</div>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <p>Configuring Apache to listen on specific addresses and ports.</p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes </div>
11f2c481e1d57bedb3f758565307501e9a2730ddtrawick<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>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes</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>
5c0419d51818eb02045cf923a9fe456127a44c60wrowe<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
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d266c3777146d36a4c23c17aad6f153aebea1bf4jorton <p>When Apache starts, it binds to some port and address on
d266c3777146d36a4c23c17aad6f153aebea1bf4jorton the local machine and waits for incoming requests. By default,
22f8da8087791fcb95b836c8a81937c5a9bba202bnicholes it listens to all addresses on the machine. However, it needs to
22f8da8087791fcb95b836c8a81937c5a9bba202bnicholes be told to listen on specific ports, or to listen on only selected
22f8da8087791fcb95b836c8a81937c5a9bba202bnicholes addresses, or a combination. 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>
cd3bbd6d2df78d6c75e5d159a81ef8bdd5f70df9trawick directive tells the server to accept
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes incoming requests only on the specified port or
0f60998368b493f90120180a93fc2e1e74490872covener address-and-port combinations. If only a port number is
0f60998368b493f90120180a93fc2e1e74490872covener specified in the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
0f60998368b493f90120180a93fc2e1e74490872covener directive, the server
0f60998368b493f90120180a93fc2e1e74490872covener listens to the given port on all interfaces. If an IP address
0f60998368b493f90120180a93fc2e1e74490872covener is given as well as a port, the server will listen on the given
0f60998368b493f90120180a93fc2e1e74490872covener port and interface. Multiple <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> directives may be used to
0f60998368b493f90120180a93fc2e1e74490872covener specify a number of addresses and ports to listen on. The
0f60998368b493f90120180a93fc2e1e74490872covener server will respond to requests from any of the listed
87587593f1a53030e840acc0dec6cc881022ea40covener addresses and ports.</p>
87587593f1a53030e840acc0dec6cc881022ea40covener
87587593f1a53030e840acc0dec6cc881022ea40covener <p>For example, to make the server accept connections on both
87587593f1a53030e840acc0dec6cc881022ea40covener port 80 and port 8000, use:</p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
43997561b2302d13dee973998e77743a3ddd2374trawick <div class="example"><p><code>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes Listen 80<br />
0568280364eb026393be492ebc732795c4934643jorton Listen 8000
0568280364eb026393be492ebc732795c4934643jorton </code></p></div>
0568280364eb026393be492ebc732795c4934643jorton
0568280364eb026393be492ebc732795c4934643jorton <p>To make the server accept connections on two specified
0568280364eb026393be492ebc732795c4934643jorton interfaces and port numbers, use</p>
0568280364eb026393be492ebc732795c4934643jorton
0568280364eb026393be492ebc732795c4934643jorton <div class="example"><p><code>
0568280364eb026393be492ebc732795c4934643jorton Listen 192.170.2.1:80<br />
0568280364eb026393be492ebc732795c4934643jorton Listen 192.170.2.5:8000
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes </code></p></div>
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener <p>IPv6 addresses must be surrounded in square brackets, as in the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes following example:</p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <div class="example"><p><code>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes Listen [fe80::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>
796e4a7141265d8ed7036e4628161c6eafb2a789jorton
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <p>A growing number of platforms implement IPv6, and APR supports
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes IPv6 on most of these platforms, allowing Apache to allocate IPv6
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes sockets and handle requests which were sent over IPv6.</p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <p>One complicating factor for Apache administrators is whether or
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes not an IPv6 socket can handle both IPv4 connections and IPv6
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes connections. Handling IPv4 connections with an IPv6 socket uses
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes 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. But even 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
8113dac419143273351446c3ad653f3fe5ba5cfdwrowe <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
95b6fe1346805e1731e6e97c15d569c73be22cf7minfrin mapped addresses. If you want Apache to handle IPv4 and IPv6 connections
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes with a minimum of sockets, which requires using IPv4-mapped IPv6
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes addresses, specify the <code>--enable-v4-mapped</code> <code class="program"><a href="/programs/configure.html">configure</a></code> option.</p>
95b6fe1346805e1731e6e97c15d569c73be22cf7minfrin
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <p><code>--enable-v4-mapped</code> is the default on all platforms but
95b6fe1346805e1731e6e97c15d569c73be22cf7minfrin FreeBSD, NetBSD, and OpenBSD, so this is probably how your Apache was
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes built.</p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <p>If you want Apache to handle IPv4 connections only, regardless of
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes 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
95b6fe1346805e1731e6e97c15d569c73be22cf7minfrin following examples:</p>
95b6fe1346805e1731e6e97c15d569c73be22cf7minfrin
95b6fe1346805e1731e6e97c15d569c73be22cf7minfrin <div class="example"><p><code>
a1790fb35c4b352dab721370985c623a9f8f5062rpluem Listen 0.0.0.0:80<br />
713a2b68bac4aeb1e9c48785006c0732451039depquerna Listen 192.170.2.1:80
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes </code></p></div>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <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
482f676c6c19b1c5bb5cca04dad11509c1da3a4cwrowe default on FreeBSD, NetBSD, and OpenBSD.</p>
482f676c6c19b1c5bb5cca04dad11509c1da3a4cwrowe </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="virtualhost" id="virtualhost">How This Works With Virtual Hosts</a></h2>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <p> <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code> does not implement
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes Virtual Hosts. It only tells the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes main server what addresses and ports to listen to. If no
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener directives are used, the server will behave
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes the same for all accepted requests. However,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
f43b67c5a9d29b572eac916f8335cedc80c908bebnicholes can be used to specify a different behavior
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes for one or more of the addresses and ports. To implement a
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes VirtualHost, the server must first be told to listen to the
8113dac419143273351446c3ad653f3fe5ba5cfdwrowe address and port to be used. Then a
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> section
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes should be created for a specified address and port to set the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes behavior of this virtual host. Note that if the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes is set for an address and port that the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes server is not listening to, it cannot be accessed.</p>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes </div></div>
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes<div class="bottomlang">
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes<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="/es/bind.html" hreflang="es" rel="alternate" title="Espa�ol">&nbsp;es&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> |
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener<a href="/ko/bind.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener</div><div id="footer">
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener<p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener<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>
4e9c24785b525d2956e6e381015c0f2bd0a72f4bcovener</body></html>