bind.html.en revision 3b3b7fc78d1f5bfc2769903375050048ff41ff26
181e56d8b348d301d615ccf5465ae600fee2867berikabele<?xml version="1.0" encoding="ISO-8859-1"?>
181e56d8b348d301d615ccf5465ae600fee2867berikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
181e56d8b348d301d615ccf5465ae600fee2867berikabele<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki This file is generated from xml source: DO NOT EDIT
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5a58787efeb02a1c3f06569d019ad81fd2efa06end -->
5a58787efeb02a1c3f06569d019ad81fd2efa06end<title>Binding - Apache HTTP Server</title>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
5a58787efeb02a1c3f06569d019ad81fd2efa06end<link href="/images/favicon.ico" rel="shortcut icon" /></head>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<body id="manual-page"><div id="page-header">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<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>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="apache">Apache HTTP Server Version 2.1</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<img alt="" src="/images/feather.gif" /></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div id="path">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<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>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div class="toplang">
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<p><span>Available Languages: </span><a href="/en/bind.html">&nbsp;en&nbsp;</a> | <a href="/ja/bind.html">&nbsp;ja&nbsp;</a></p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
b442af56a5e2104663b84fb345c070ce185d4ab3slive <p>Configuring Apache to listen on specific addresses and ports.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end </div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#overview">Overview</a></li>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<li><img alt="" src="/images/down.gif" /> <a href="#ipv6">Special IPv6 Considerations</a></li>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<li><img alt="" src="/images/down.gif" /> <a href="#virtualhost">How This Works With Virtual Hosts</a></li>
5a58787efeb02a1c3f06569d019ad81fd2efa06end</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>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="section">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="overview" id="overview">Overview</a></h2>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
b442af56a5e2104663b84fb345c070ce185d4ab3slive
09ad82b467d18345648fe3fa155a5914984980dfnd <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>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
b442af56a5e2104663b84fb345c070ce185d4ab3slive
b442af56a5e2104663b84fb345c070ce185d4ab3slive <p>When Apache starts, it binds to some port and address on
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the local machine and waits for incoming requests. By default,
cd694e2baec0c53e1b764ffe52ef88dcb68cfd53jerenkrantz it listens to all addresses on the machine. However, it needs to
b442af56a5e2104663b84fb345c070ce185d4ab3slive be told to listen on specific ports, or to listen on only selected
cd694e2baec0c53e1b764ffe52ef88dcb68cfd53jerenkrantz addresses, or a combination. This is often combined with the
cd694e2baec0c53e1b764ffe52ef88dcb68cfd53jerenkrantz Virtual Host feature which determines how Apache responds to
cd694e2baec0c53e1b764ffe52ef88dcb68cfd53jerenkrantz different IP addresses, hostnames and ports.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen
181e56d8b348d301d615ccf5465ae600fee2867berikabele <p>The <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki directive tells the server to accept
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen incoming requests only on the specified port or
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen address-and-port combinations. If only a port number is
181e56d8b348d301d615ccf5465ae600fee2867berikabele specified in the <code class="directive"><a href="/mod/mpm_common.html#listen">Listen</a></code>
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki directive, the server
cd694e2baec0c53e1b764ffe52ef88dcb68cfd53jerenkrantz listens to the given port on all interfaces. If an IP address
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen is given as well as a port, the server will listen on the given
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen port and interface. Multiple Listen directives may be used to
b442af56a5e2104663b84fb345c070ce185d4ab3slive specify a number of addresses and ports to listen on. The
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen server will respond to requests from any of the listed
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen addresses and ports.</p>
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>For example, to make the server accept connections on both
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen port 80 and port 8000, use:</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
181e56d8b348d301d615ccf5465ae600fee2867berikabele <div class="example"><p><code>
181e56d8b348d301d615ccf5465ae600fee2867berikabele Listen 80<br />
b442af56a5e2104663b84fb345c070ce185d4ab3slive Listen 8000
181e56d8b348d301d615ccf5465ae600fee2867berikabele </code></p></div>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
b442af56a5e2104663b84fb345c070ce185d4ab3slive <p>To make the server accept connections on two specified
b442af56a5e2104663b84fb345c070ce185d4ab3slive interfaces and port numbers, use</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
181e56d8b348d301d615ccf5465ae600fee2867berikabele <div class="example"><p><code>
181e56d8b348d301d615ccf5465ae600fee2867berikabele Listen 192.170.2.1:80<br />
b442af56a5e2104663b84fb345c070ce185d4ab3slive Listen 192.170.2.5:8000
181e56d8b348d301d615ccf5465ae600fee2867berikabele </code></p></div>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
b442af56a5e2104663b84fb345c070ce185d4ab3slive <p>IPv6 addresses must be surrounded in square brackets, as in the
b442af56a5e2104663b84fb345c070ce185d4ab3slive following example:</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
181e56d8b348d301d615ccf5465ae600fee2867berikabele <div class="example"><p><code>
b442af56a5e2104663b84fb345c070ce185d4ab3slive Listen [fe80::a00:20ff:fea7:ccea]:80
181e56d8b348d301d615ccf5465ae600fee2867berikabele </code></p></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="section">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="ipv6" id="ipv6">Special IPv6 Considerations</a></h2>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
b442af56a5e2104663b84fb345c070ce185d4ab3slive
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>A growing number of platforms implement IPv6, and APR supports
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick IPv6 on most of these platforms, allowing Apache to allocate IPv6
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick sockets and handle requests which were sent over IPv6.</p>
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>One complicating factor for Apache administrators is whether or
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick not an IPv6 socket can handle both IPv4 connections and IPv6
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick connections. Handling IPv4 connections with an IPv6 socket uses
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick IPv4-mapped IPv6 addresses, which are allowed by default on most
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick platforms but are disallowed by default on FreeBSD, NetBSD, and
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick OpenBSD in order to match the system-wide policy on those
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick platforms. But even on systems where it is disallowed by default, a
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick special configure parameter can change this behavior for Apache.</p>
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>If you want Apache to handle IPv4 and IPv6 connections with a
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick minimum of sockets, which requires using IPv4-mapped IPv6 addresses,
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick specify the <code>--enable-v4-mapped</code> configure option and use
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick generic Listen directives like the following:</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
181e56d8b348d301d615ccf5465ae600fee2867berikabele <div class="example"><p><code>
b442af56a5e2104663b84fb345c070ce185d4ab3slive Listen 80
181e56d8b348d301d615ccf5465ae600fee2867berikabele </code></p></div>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>With <code>--enable-v4-mapped</code>, the Listen directives in the
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick default configuration file created by Apache will use this form.
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <code>--enable-v4-mapped</code> is the default on all platforms but
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick FreeBSD, NetBSD, and OpenBSD, so this is probably how your Apache was
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick built.</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>If you want Apache to handle IPv4 connections only, regardless of
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick what your platform and APR will support, specify an IPv4 address on all
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick Listen directives, as in the following examples:</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
181e56d8b348d301d615ccf5465ae600fee2867berikabele <div class="example"><p><code>
b4600e71d7e8201b3c14c67f4ef873cadd4c1d17trawick Listen 0.0.0.0:80<br />
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick Listen 192.170.2.1:80
181e56d8b348d301d615ccf5465ae600fee2867berikabele </code></p></div>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>If you want Apache to handle IPv4 and IPv6 connections on separate
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick sockets (i.e., to disable IPv4-mapped addresses), specify the
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <code>--disable-v4-mapped</code> configure option and use specific Listen
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick directives like the following:</p>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
181e56d8b348d301d615ccf5465ae600fee2867berikabele <div class="example"><p><code>
b4600e71d7e8201b3c14c67f4ef873cadd4c1d17trawick Listen [::]:80<br />
b442af56a5e2104663b84fb345c070ce185d4ab3slive Listen 0.0.0.0:80
181e56d8b348d301d615ccf5465ae600fee2867berikabele </code></p></div>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <p>With <code>--disable-v4-mapped</code>, the Listen directives in the
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick default configuration file created by Apache will use this form.
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick <code>--disable-v4-mapped</code> is the default on FreeBSD, NetBSD, and
4566c682d671cfda9cfcb77ea3f8e3fb8a265010trawick OpenBSD.</p>
455a5f75c9935108a7ac1d50996f404e0553ac17paul
5a58787efeb02a1c3f06569d019ad81fd2efa06end </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<div class="section">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<h2><a name="virtualhost" id="virtualhost">How This Works With Virtual Hosts</a></h2>
b442af56a5e2104663b84fb345c070ce185d4ab3slive
455a5f75c9935108a7ac1d50996f404e0553ac17paul
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen <p>Listen does not implement Virtual Hosts. It only tells the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen main server what addresses and ports to listen to. If no
181e56d8b348d301d615ccf5465ae600fee2867berikabele <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki directives are used, the server will behave
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen the same for all accepted requests. However,
181e56d8b348d301d615ccf5465ae600fee2867berikabele <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki can be used to specify a different behavior
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen for one or more of the addresses and ports. To implement a
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen VirtualHost, the server must first be told to listen to the
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki address and port to be used. Then a
181e56d8b348d301d615ccf5465ae600fee2867berikabele <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> section
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen should be created for a specified address and port to set the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen behavior of this virtual host. Note that if the
181e56d8b348d301d615ccf5465ae600fee2867berikabele <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
b1ced323143ade589985456a78f3f64d6a6580c5yoshiki is set for an address and port that the
57d0156f7bbd9ea3a72342cf9912aba61d118702rbowen server is not listening to, it cannot be accessed.</p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end </div></div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div class="bottomlang">
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<p><span>Available Languages: </span><a href="/en/bind.html">&nbsp;en&nbsp;</a> | <a href="/ja/bind.html">&nbsp;ja&nbsp;</a></p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</div><div id="footer">
5a58787efeb02a1c3f06569d019ad81fd2efa06end<p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
5a58787efeb02a1c3f06569d019ad81fd2efa06end<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>
5a58787efeb02a1c3f06569d019ad81fd2efa06end</body></html>