home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Software / Resources / Apache / apache_2.0.48-win32-x86-no_ssl.exe / F253657_cgi_path.html.en < prev    next >
Encoding:
Text File  |  2003-06-29  |  7.0 KB  |  137 lines

  1. aq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
  2. <p class="apache">Apache HTTP Server Version 2.0</p>
  3. <img alt="" src="./images/feather.gif" /></div>
  4. <div class="up"><a href="./"><img title="<-" alt="<-" src="./images/left.gif" /></a></div>
  5. <div id="path">
  6. <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="./">Version 2.0</a></div><div id="page-"tent"><div id="preamble"><h1>Binding</h1>
  7. <div class="toplang">
  8. <p><span>Available Languages: </span><a href="./en/bind.html" title="English"> en </a> |
  9. <a href="./ja/bind.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
  10. <a href="./ko/bind.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
  11. </div>
  12.  
  13.     <p>Configuring Apache to listen on specific addresses and ports.</p>
  14.   </div>
  15. <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#overview">Overview</a></li>
  16. <li><img alt="" src="./images/down.gif" /> <a href="#ipv6">Special IPv6 Considerations</a></li>
  17. <li><img alt="" src="./images/down.gif" /> <a href="#virtualhost">How This Works With Virtual Hosts</a></li>
  18. </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>
  19. <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  20. <div class="section">
  21. <h2><a name="overview" id="overview">Overview</a></h2>
  22.     
  23.  
  24.     <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"><VirtualHost></a></code></li><li><code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code></li></ul></td></tr></table>
  25.  
  26.  
  27.     <p>When Apache starts, it binds to some port and address on
  28.     the local machine and waits for incoming requests. By default,
  29.     it listens to all addresses on the machine.  However, it needs to
  30.     be told to listen on specific ports, or to listen on only selected 
  31.     addresses, or a combination. This is often combined with the 
  32.     Virtual Host feature which determines how Apache responds to 
  33.     different IP addresses, hostnames and ports.</p>
  34.  
  35.     <p>The <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code>
  36.     directive tells the server to accept
  37.     incoming requests only on the specified port or
  38.     address-and-port combinations. If only a port number is
  39.     specified in the <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code>
  40.     directive, the server
  41.     listens to the given port on all interfaces. If an IP address
  42.     is given as well as a port, the server will listen on the given
  43.     port and interface. Multiple Listen directives may be used to
  44.     specify a number of addresses and ports to listen on. The
  45.     server will respond to requests from any of the listed
  46.     addresses and ports.</p>
  47.  
  48.     <p>For example, to make the server accept connections on both
  49.     port 80 and port 8000, use:</p>
  50.  
  51.     <div class="example"><p><code>
  52.       Listen 80<br />
  53.       Listen 8000
  54.     </code></p></div>
  55.  
  56.     <p>To make the server accept connections on two specified
  57.     interfaces and port numbers, use</p>
  58.  
  59.     <div class="example"><p><code>
  60.       Listen 192.170.2.1:80<br />
  61.       Listen 192.170.2.5:8000
  62.     </code></p></div>
  63.  
  64.     <p>IPv6 addresses must be surrounded in square brackets, as in the
  65.     following example:</p>
  66.  
  67.     <div class="example"><p><code>
  68.       Listen [fe80::a00:20ff:fea7:ccea]:80
  69.     </code></p></div>
  70.   </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  71. <div class="section">
  72. <h2><a name="ipv6" id="ipv6">Special IPv6 Considerations</a></h2>
  73.     
  74.  
  75.     <p>A growing number of platforms implement IPv6, and APR supports 
  76.     IPv6 on most of these platforms, allowing Apache to allocate IPv6 
  77.     sockets and handle requests which were sent over IPv6.</p>
  78.  
  79.     <p>One complicating factor for Apache administrators is whether or
  80.     not an IPv6 socket can handle both IPv4 connections and IPv6 
  81.     connections.  Handling IPv4 connections with an IPv6 socket uses 
  82.     IPv4-mapped IPv6 addresses, which are allowed by default on most 
  83.     platforms but are disallowed by default on FreeBSD, NetBSD, and 
  84.     OpenBSD in order to match the system-wide policy on those
  85.     platforms.  But even on systems where it is disallowed by default, a 
  86.     special configure parameter can change this behavior for Apache.</p>
  87.  
  88.     <p>If you want Apache to handle IPv4 and IPv6 connections with a 
  89.     minimum of sockets, which requires using IPv4-mapped IPv6 addresses, 
  90.     specify the <code>--enable-v4-mapped</code> configure option and use 
  91.     generic Listen directives like the following:</p>
  92.  
  93.     <div class="example"><p><code>
  94.       Listen 80
  95.     </code></p></div>
  96.  
  97.     <p>With <code>--enable-v4-mapped</code>, the Listen directives in the 
  98.     default configuration file created by Apache will use this form.  
  99.     <code>--enable-v4-mapped</code> is the default on all platforms but 
  100.     FreeBSD, NetBSD, and OpenBSD, so this is probably how your Apache was 
  101.     built.</p>
  102.  
  103.     <p>If you want Apache to handle IPv4 connections only, regardless of 
  104.     what your platform and APR will support, specify an IPv4 address on all 
  105.     Listen directives, as in the following examples:</p>
  106.  
  107.     <div class="example"><p><code>
  108.       Listen 0.0.0.0:80<br />
  109.       Listen 192.170.2.1:80
  110.     </code></p></div>
  111.  
  112.     <p>If you want Apache to handle IPv4 and IPv6 connections on separate 
  113.     sockets (i.e., to disable IPv4-mapped addresses), specify the 
  114.     <code>--disable-v4-mapped</code> configure option and use specific Listen 
  115.     directives like the following:</p>
  116.  
  117.     <div class="example"><p><code>
  118.       Listen [::]:80<br />
  119.       Listen 0.0.0.0:80
  120.     </code></p></div>
  121.  
  122.     <p>With <code>--disable-v4-mapped</code>, the Listen directives in the 
  123.     default configuration file created by Apache will use this form.  
  124.     <code>--disable-v4-mapped</code> is the default on FreeBSD, NetBSD, and 
  125.     OpenBSD.</p>
  126.  
  127.   </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
  128. <div class="section">
  129. <h2><a name="virtualhost" id="virtualhost">How This Works With Virtual Hosts</a></h2>
  130.     
  131.  
  132.     <p>Listen does not implement Virtual Hosts. It only tells the
  133.     main server what addresses and ports to listen to. If no
  134.     <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code>
  135.     directives are used, the server will behave
  136.     the same for all accepted requests. However,
  137.     <code class="directive"><a