|
42 | 42 |
|
43 | 43 | <p>When Apache starts, it binds to some port and address on |
44 | 44 | the local machine and waits for incoming requests. By default, |
45 | | - it listens to all addresses on the machine. However, it needs to |
46 | | - be told to listen on specific ports, or to listen on only selected |
47 | | - addresses, or a combination. This is often combined with the |
48 | | - Virtual Host feature which determines how Apache responds to |
| 45 | + it listens to all addresses on the machine. However, it may need to |
| 46 | + be told to listen on specific ports, or only on selected |
| 47 | + addresses, or a combination of both. This is often combined with the |
| 48 | + Virtual Host feature, which determines how Apache responds to |
49 | 49 | different IP addresses, hostnames and ports.</p> |
50 | 50 |
|
51 | 51 | <p>The <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> |
52 | 52 | directive tells the server to accept |
53 | | - incoming requests only on the specified port or |
| 53 | + incoming requests only on the specified ports or |
54 | 54 | address-and-port combinations. If only a port number is |
55 | 55 | specified in the <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> |
56 | 56 | directive, the server |
|
62 | 62 | addresses and ports.</p> |
63 | 63 |
|
64 | 64 | <p>For example, to make the server accept connections on both |
65 | | - port 80 and port 8000, use:</p> |
| 65 | + port 80 and port 8000, on all interfaces, use:</p> |
66 | 66 |
|
67 | 67 | <div class="example"><p><code> |
68 | 68 | Listen 80<br /> |
69 | 69 | Listen 8000 |
70 | 70 | </code></p></div> |
71 | 71 |
|
72 | | - <p>To make the server accept connections on two specified |
73 | | - interfaces and port numbers, use</p> |
| 72 | + <p>To make the server accept connections on port 80 for one interface, |
| 73 | + and port 8080 on another, use</p> |
74 | 74 |
|
75 | 75 | <div class="example"><p><code> |
76 | | - Listen 192.170.2.1:80<br /> |
77 | | - Listen 192.170.2.5:8000 |
| 76 | + Listen 192.0.2.1:80<br /> |
| 77 | + Listen 192.0.2.5:8000 |
78 | 78 | </code></p></div> |
79 | 79 |
|
80 | | - <p>IPv6 addresses must be surrounded in square brackets, as in the |
| 80 | + <p>IPv6 addresses must be enclosed in square brackets, as in the |
81 | 81 | following example:</p> |
82 | 82 |
|
83 | 83 | <div class="example"><p><code> |
|
90 | 90 |
|
91 | 91 | <p>A growing number of platforms implement IPv6, and |
92 | 92 | <a class="glossarylink" href="./glossary.html#apr" title="see glossary">APR</a> supports IPv6 on most of these platforms, |
93 | | - allowing Apache to allocate IPv6 sockets and handle requests which |
94 | | - were sent over IPv6.</p> |
| 93 | + allowing Apache to allocate IPv6 sockets, and to handle requests sent |
| 94 | + over IPv6.</p> |
95 | 95 |
|
96 | 96 | <p>One complicating factor for Apache administrators is whether or |
97 | 97 | not an IPv6 socket can handle both IPv4 connections and IPv6 |
98 | 98 | connections. Handling IPv4 connections with an IPv6 socket uses |
99 | 99 | IPv4-mapped IPv6 addresses, which are allowed by default on most |
100 | | - platforms but are disallowed by default on FreeBSD, NetBSD, and |
101 | | - OpenBSD in order to match the system-wide policy on those |
102 | | - platforms. But even on systems where it is disallowed by default, a |
| 100 | + platforms, but are disallowed by default on FreeBSD, NetBSD, and |
| 101 | + OpenBSD, in order to match the system-wide policy on those |
| 102 | + platforms. On systems where it is disallowed by default, a |
103 | 103 | special <code class="program"><a href="./programs/configure.html">configure</a></code> parameter can change this behavior |
104 | 104 | for Apache.</p> |
105 | 105 |
|
106 | | - <p>On the other hand, on some platforms such as Linux and Tru64 the |
| 106 | + <p>On the other hand, on some platforms, such as Linux and Tru64, the |
107 | 107 | <strong>only</strong> way to handle both IPv6 and IPv4 is to use |
108 | 108 | mapped addresses. If you want Apache to handle IPv4 and IPv6 connections |
109 | 109 | with a minimum of sockets, which requires using IPv4-mapped IPv6 |
110 | 110 | addresses, specify the <code>--enable-v4-mapped</code> <code class="program"><a href="./programs/configure.html">configure</a></code> option.</p> |
111 | 111 |
|
112 | | - <p><code>--enable-v4-mapped</code> is the default on all platforms but |
| 112 | + <p><code>--enable-v4-mapped</code> is the default on all platforms except |
113 | 113 | FreeBSD, NetBSD, and OpenBSD, so this is probably how your Apache was |
114 | 114 | built.</p> |
115 | 115 |
|
|
120 | 120 |
|
121 | 121 | <div class="example"><p><code> |
122 | 122 | Listen 0.0.0.0:80<br /> |
123 | | - Listen 192.170.2.1:80 |
| 123 | + Listen 192.0.2.1:80 |
124 | 124 | </code></p></div> |
125 | 125 |
|
126 | 126 | <p>If your platform supports it and you want Apache to handle IPv4 and |
127 | | - IPv6 connections on separate sockets (i.e., to disable IPv4-mapped |
| 127 | + IPv6 connections on separate sockets (i.e., to disable IPv4-mapped |
128 | 128 | 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 |
129 | 129 | default on FreeBSD, NetBSD, and OpenBSD.</p> |
130 | 130 | </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div> |
131 | 131 | <div class="section"> |
132 | 132 | <h2><a name="virtualhost" id="virtualhost">How This Works With Virtual Hosts</a></h2> |
133 | 133 |
|
134 | 134 |
|
135 | | - <p> <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> does not implement |
136 | | - Virtual Hosts. It only tells the |
137 | | - main server what addresses and ports to listen to. If no |
| 135 | + <p> The <code class="directive"><a href="./mod/mpm_common.html#listen">Listen</a></code> directive does not implement |
| 136 | + Virtual Hosts - it only tells the |
| 137 | + main server what addresses and ports to listen on. If no |
138 | 138 | <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> |
139 | 139 | directives are used, the server will behave |
140 | | - the same for all accepted requests. However, |
| 140 | + in the same way for all accepted requests. However, |
141 | 141 | <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> |
142 | 142 | can be used to specify a different behavior |
143 | | - for one or more of the addresses and ports. To implement a |
| 143 | + for one or more of the addresses or ports. To implement a |
144 | 144 | VirtualHost, the server must first be told to listen to the |
145 | 145 | address and port to be used. Then a |
146 | 146 | <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> section |
147 | | - should be created for a specified address and port to set the |
| 147 | + should be created for the specified address and port to set the |
148 | 148 | behavior of this virtual host. Note that if the |
149 | 149 | <code class="directive"><a href="./mod/core.html#virtualhost"><VirtualHost></a></code> |
150 | 150 | is set for an address and port that the |
|
0 commit comments