summaryrefslogtreecommitdiff
path: root/docs/manual
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2010-12-28 00:53:56 +0000
committerEric Covener <covener@apache.org>2010-12-28 00:53:56 +0000
commitef81d4ba83ce827f331ef1df8d67415dd03787a9 (patch)
treeb59a9d23853579b596e125043bdb34f85ec12b6b /docs/manual
parent458ab7f915b1c847e2aa0a63e8e6e82770940b2d (diff)
downloadhttpd-ef81d4ba83ce827f331ef1df8d67415dd03787a9.tar.gz
Doc for r1053230, NameVirtualHost is now unnecessary and other general NVH-vs-VH improvements.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053231 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs/manual')
-rw-r--r--docs/manual/mod/core.xml144
-rw-r--r--docs/manual/upgrading.xml9
-rw-r--r--docs/manual/vhosts/details.xml157
-rw-r--r--docs/manual/vhosts/examples.xml42
-rw-r--r--docs/manual/vhosts/index.xml1
-rw-r--r--docs/manual/vhosts/ip-based.xml24
-rw-r--r--docs/manual/vhosts/mass.xml1
-rw-r--r--docs/manual/vhosts/name-based.xml65
8 files changed, 114 insertions, 329 deletions
diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml
index cb636e9f00..a22ed5e908 100644
--- a/docs/manual/mod/core.xml
+++ b/docs/manual/mod/core.xml
@@ -1888,9 +1888,7 @@ Apache httpd 2.3.2 and later</compatibility>
occupied waiting on connections with idle clients.</p>
<p>In a name-based virtual host context, the value of the first
- defined virtual host (the default host) in a set of <directive
- module="core">NameVirtualHost</directive> will be used.
- The other values will be ignored.</p>
+ defined virtual host best matching the local IP and port will be used.</p>
</usage>
</directivesynopsis>
@@ -2141,7 +2139,7 @@ will be accepted from the client</description>
<note type="warning"><title>Warning</title>
<p> When name-based virtual hosting is used, the value for this
directive is taken from the default (first-listed) virtual host for the
- <directive>NameVirtualHost</directive> the connection was mapped to.</p>
+ local IP and port combination</p>.
</note>
</usage>
@@ -2184,10 +2182,9 @@ client</description>
<note type="warning"><title>Warning</title>
<p> When name-based virtual hosting is used, the value for this
- directive is taken from the default (first-listed) virtual host for the
- <directive>NameVirtualHost</directive> the connection was mapped to.</p>
+ directive is taken from the default (first-listed) virtual host best
+ matching the current IP address and port combination.</p>
</note>
-
</usage>
</directivesynopsis>
@@ -2228,8 +2225,8 @@ from the client</description>
<note type="warning"><title>Warning</title>
<p> When name-based virtual hosting is used, the value for this
- directive is taken from the default (first-listed) virtual host for the
- <directive>NameVirtualHost</directive> the connection was mapped to.</p>
+ directive is taken from the default (first-listed) virtual host best
+ matching the current IP address and port combination.</p>
</note>
</usage>
@@ -2892,82 +2889,13 @@ hosting</description>
<usage>
-<p>A single <directive>NameVirtualHost</directive> directive
-identifies a set of identical virtual hosts on which the server will
-further select from on the basis of the <em>hostname</em>
-requested by the client. The <directive>NameVirtualHost</directive>
-directive is a required directive if you want to configure
-<a href="../vhosts/">name-based virtual hosts</a>.</p>
-
-<p>This directive, and the corresponding <directive >VirtualHost</directive>,
-<em>must</em> be qualified with a port number if the server supports both HTTP
-and HTTPS connections.</p>
-
-<p>Although <var>addr</var> can be a hostname, it is recommended
-that you always use an IP address or a wildcard. A wildcard
-NameVirtualHost matches only virtualhosts that also have a literal wildcard
-as their argument.</p>
-
-<p>In cases where a firewall or other proxy receives the requests and
-forwards them on a different IP address to the server, you must specify the
-IP address of the physical interface on the machine which will be
-servicing the requests. </p>
-
-<p> In the example below, requests received on interface 192.0.2.1 and port 80
-will only select among the first two virtual hosts. Requests received on
-port 80 on any other interface will only select among the third and fourth
-virtual hosts. In the common case where the interface isn't important
-to the mapping, only the "*:80" NameVirtualHost and VirtualHost directives
-are necessary.</p>
-
- <example>
- NameVirtualHost 192.0.2.1:80<br />
- NameVirtualHost *:80<br /><br />
-
- &lt;VirtualHost 192.0.2.1:80&gt;<br />
- &nbsp; ServerName namebased-a.example.com<br />
- &lt;/VirtualHost&gt;<br />
- <br />
- &lt;VirtualHost 192.0.2.1:80&gt;<br />
- &nbsp; Servername namebased-b.example.com<br />
- &lt;/VirtualHost&gt;<br />
- <br />
- &lt;VirtualHost *:80&gt;<br />
- &nbsp; ServerName namebased-c.example.com <br />
- &lt;/VirtualHost&gt;<br />
- <br />
- &lt;VirtualHost *:80&gt;<br />
- &nbsp; ServerName namebased-d.example.com <br />
- &lt;/VirtualHost&gt;<br />
- <br />
-
- </example>
-
- <p>If no matching virtual host is found, then the first listed
- virtual host that matches the IP address and port will be used.</p>
-
-
- <p>IPv6 addresses must be enclosed in square brackets, as shown
- in the following example:</p>
+<p>Prior to 2.3.11, <directive>NameVirtualHost</directive> was required
+to instruct the server that a particular IP address and port combination
+was usable as a name-based virtual host. In 2.3.11 and later,
+any time an IP address and port combination is used in multiple virtual
+hosts, name-based virtual hosting is automatically enabled for that address.</p>
- <example>
- NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:8080
- </example>
-
- <note><title>Argument to <directive type="section">VirtualHost</directive>
- directive</title>
- <p>Note that the argument to the <directive
- type="section">VirtualHost</directive> directive must
- exactly match the argument to the <directive
- >NameVirtualHost</directive> directive.</p>
-
- <example>
- NameVirtualHost 192.0.2.2:80<br />
- &lt;VirtualHost 192.0.2.2:80&gt;<br />
- # ...<br />
- &lt;/VirtualHost&gt;<br />
- </example>
- </note>
+<p>This directive currently has no effect.</p>
</usage>
<seealso><a href="../vhosts/">Virtual Hosts
@@ -3524,7 +3452,6 @@ itself</description>
documentation</a></seealso>
<seealso><directive module="core">UseCanonicalName</directive></seealso>
<seealso><directive module="core">UseCanonicalPhysicalPort</directive></seealso>
-<seealso><directive module="core">NameVirtualHost</directive></seealso>
<seealso><directive module="core">ServerAlias</directive></seealso>
</directivesynopsis>
@@ -3988,7 +3915,8 @@ hostname or IP address</description>
used. When the server receives a request for a document on a
particular virtual host, it uses the configuration directives
enclosed in the <directive type="section">VirtualHost</directive>
- section. <var>Addr</var> can be:</p>
+ section. <var>Addr</var> can be any of the following, optionally followed by
+ a colon and a port number (or *):</p>
<ul>
<li>The IP address of the virtual host;</li>
@@ -3996,15 +3924,15 @@ hostname or IP address</description>
<li>A fully qualified domain name for the IP address of the
virtual host (not recommended);</li>
- <li>The character <code>*</code>, which is used only in combination with
- <code>NameVirtualHost *</code> to match all IP addresses; or</li>
+ <li>The character <code>*</code>, which acts as a wildcard and matches
+ any IP address.</li>
+
+ <li>The string <code>_default_</code>, which is an alias for <code>*</code></li>
- <li>The string <code>_default_</code>, which is used only
- with IP virtual hosting to catch unmatched IP addresses.</li>
</ul>
<example><title>Example</title>
- &lt;VirtualHost 10.1.2.3&gt;<br />
+ &lt;VirtualHost 10.1.2.3:80&gt;<br />
<indent>
ServerAdmin webmaster@host.example.com<br />
DocumentRoot /www/docs/host.example.com<br />
@@ -4021,7 +3949,7 @@ hostname or IP address</description>
IPv6 example is shown below:</p>
<example>
- &lt;VirtualHost [2001:db8::a00:20ff:fea7:ccea]&gt;<br />
+ &lt;VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80&gt;<br />
<indent>
ServerAdmin webmaster@host.example.com<br />
DocumentRoot /www/docs/host.example.com<br />
@@ -4047,31 +3975,25 @@ hostname or IP address</description>
using <directive module="mpm_common">Listen</directive>.</p>
</note>
- <p>When using IP-based virtual hosting, the special name
- <code>_default_</code> can be specified in
- which case this virtual host will match any IP address that is
- not explicitly listed in another virtual host. In the absence
- of any <code>_default_</code> virtual host the "main" server config,
- consisting of all those definitions outside any VirtualHost
- section, is used when no IP-match occurs.</p>
-
- <p>You can specify a <code>:port</code> to change the port that is
- matched. If unspecified then it defaults to the same port as the
- most recent <directive module="mpm_common">Listen</directive>
- statement of the main server. You may also specify <code>:*</code>
- to match all ports on that address. (This is recommended when used
- with <code>_default_</code>.)</p>
-
<p>A <directive module="core">ServerName</directive> should be
specified inside each <directive
type="section">VirtualHost</directive> block. If it is absent, the
<directive module="core">ServerName</directive> from the "main"
server configuration will be inherited.</p>
- <p>If no matching virtual host is found, then the first listed
- virtual host that matches the IP address will be used. As a
- consequence, the first listed virtual host is the default virtual
- host.</p>
+ <p>When a request is received, the server first maps it to the best matching
+ <directive type="section">VirtualHost</directive> based on the local
+ IP address and port combination only. Non-wildcards have a higher
+ precedence. if no match based on IP and port occurs at all, the
+ "main" server configuration is used.</p>
+
+ <p>If multiple virtual hosts contain the best matching IP address and port,
+ the server selects from these virtual hosts the best match based on the
+ requested hostname. If no matching name-based virtual host is found,
+ then the first listed virtual host that matched the IP address will be
+ used. As a consequence, the first listed virtual for a given IP address
+ and port combination is default virtual host for that IP and port
+ combination.</p>
<note type="warning"><title>Security</title>
<p>See the <a href="../misc/security_tips.html">security tips</a>
diff --git a/docs/manual/upgrading.xml b/docs/manual/upgrading.xml
index dd31588bb5..a5f385da7e 100644
--- a/docs/manual/upgrading.xml
+++ b/docs/manual/upgrading.xml
@@ -225,7 +225,6 @@
module="filter">FilterProvider</directive> syntax has changed and
now uses a boolean expression to determine if a filter is applied.
</li>
-
</ul>
</section>
</section>
@@ -239,6 +238,12 @@
ignored.</li>
<li><program>htpasswd</program> now uses MD5 hash by default on
all platforms.</li>
+
+ <li>The <directive module="core">NameVirtualHost</directive>
+ directive no longer has any effect, other than to emit a
+ warning. Any address/port combination appearing in multiple
+ virtual hosts is implicitly treated as a name-based virtual host.
+ </li>
</ul>
@@ -264,8 +269,6 @@
- load module <module>mod_access_compat</module>, or update configuration to 2.4 authorization directives.</li>
<li><code>Ignoring deprecated use of DefaultType in line NN of /path/to/httpd.conf</code> - remove <directive module="core">DefaultType</directive>
and replace with other configuration settings.</li>
- <li><code>mixing * ports and non-* ports with a NameVirtualHost address is not supported</code>, <code>Either NameVirtualHost w.x.y.z:n has no VirtualHosts, or there is more than one identical NameVirtualHost line, or your VirtualHost declarations do not match the NameVirtualHost line</code> - these are not new messages, but they now cause startup to fail</li>
- <li><code>_default_ is not allowed in NameVirtualHost directive</code> - self-explanatory; was never valid, but now causes startup to fail.</li>
</ul></li>
<li>Errors serving requests:
<ul>
diff --git a/docs/manual/vhosts/details.xml b/docs/manual/vhosts/details.xml
index 5702131a68..8fc83fd933 100644
--- a/docs/manual/vhosts/details.xml
+++ b/docs/manual/vhosts/details.xml
@@ -66,16 +66,10 @@
resolutions fail, those virtual host definitions are ignored.
This is, therefore, not recommended.</p>
- <p>If using IP-based vhosts, the address can be specified
- as <code>_default_</code>, which will match a request if no
- other vhost has the explicit address on which the request was
- received.</p>
-
- <p>If using name-based vhosts, the address can be specified as
+ <p>The address can be specified as
<code>*</code>, which will match a request if no
other vhost has the explicit address on which the request was
- received. The corresponding <code>NameVirtualHost</code>
- directive must also use <code>*</code>.</p>
+ received. </p>
<p>The address appearing in the <code>VirtualHost</code>
directive can have an optional port. If the port is unspecified,
@@ -95,11 +89,10 @@
results from DNS lookups) are called the vhost's
<em>address set</em>.</p>
- <p>If you want Apache to discriminate on the
- basis of the HTTP <code>Host</code> header supplied by the client,
- the <code>NameVirtualHost</code> directive <em>must</em> appear
- with the exact IP address (or wildcard) and port pair used in a
- corresponding set of <code>VirtualHost</code> directives.</p>
+ <p>Apache automatically discriminates on the
+ basis of the HTTP <code>Host</code> header supplied by the client
+ whenever the most specific match for an IP address and port combination
+ is listed in multiple virtual hosts.</p>
<p>The
<directive module="core">ServerName</directive> directive
@@ -108,11 +101,6 @@
server). If no <code>ServerName</code> is specified, the server
attempts to deduce it from the server's IP address.</p>
- <p>Multiple <code>NameVirtualHost</code> directives can be used,
- each with a set of <code>VirtualHost</code> directives, but only
- one <code>NameVirtualHost</code> directive should be used for
- each specific IP:port pair.</p>
-
<p>The first name-based vhost in the configuration file for a
given IP:port pair is significant because it is used for all
requests received on that address and port for which no other
@@ -121,66 +109,6 @@
server does not support <glossary
ref="servernameindication">Server Name Indication</glossary>.</p>
- <p>If there are no vhosts defined for an address in a
- <code>NameVirtualHost</code> directive, the
- <code>NameVirtualHost</code> directive is ignored at startup and an error is
- logged.</p>
-
- <p>The ordering of <code>NameVirtualHost</code> and
- <code>VirtualHost</code> directives is not important, which
- makes the following two examples identical (only the order of
- the <code>VirtualHost</code> directives for <em>one</em>
- address set is important, see below):</p>
-
-<table><tr>
-<td><example>
- NameVirtualHost 111.22.33.44<br />
- &lt;VirtualHost 111.22.33.44&gt;<br />
- # server A<br />
- ...<br />
- &lt;/VirtualHost&gt;<br />
- &lt;VirtualHost 111.22.33.44&gt;<br />
- # server B<br />
- ...<br />
- &lt;/VirtualHost&gt;<br />
- <br />
- NameVirtualHost 111.22.33.55<br />
- &lt;VirtualHost 111.22.33.55&gt;<br />
- # server C<br />
- ...<br />
- &lt;/VirtualHost&gt;<br />
- &lt;VirtualHost 111.22.33.55&gt;<br />
- # server D<br />
- ...<br />
- &lt;/VirtualHost&gt;
-</example></td>
-<td><example>
- &lt;VirtualHost 111.22.33.44&gt;<br />
- # server A<br />
- &lt;/VirtualHost&gt;<br />
- &lt;VirtualHost 111.22.33.55&gt;<br />
- # server C<br />
- ...<br />
- &lt;/VirtualHost&gt;<br />
- &lt;VirtualHost 111.22.33.44&gt;<br />
- # server B<br />
- ...<br />
- &lt;/VirtualHost&gt;<br />
- &lt;VirtualHost 111.22.33.55&gt;<br />
- # server D<br />
- ...<br />
- &lt;/VirtualHost&gt;<br />
- <br />
- NameVirtualHost 111.22.33.44<br />
- NameVirtualHost 111.22.33.55<br />
- <br />
-</example></td>
-</tr></table>
-
-
- <p>(To aid the readability of your configuration you should
- prefer the left variant.)</p>
-
<p>For every vhost various default values are set. In
particular:</p>
@@ -245,10 +173,6 @@
<p>If there are no exact matches for the address and port, then
wildcard (<code>*</code>) matches are considered.</p>
- <p>If there are still no matches, then vhosts with IP
- address specified as <code>_default_</code> that match the
- port are considered.</p>
-
<p>If no matches are found, the request is served by the
main server.</p>
@@ -260,17 +184,19 @@
<section id="ipbased"><title>IP-based vhost</title>
- <p>If there is no <code>NameVirtualHost</code> directive
- matching the vhost, no further actions are performed and
- the request is served from the first matching vhost.</p>
+ <p>If there is exactly one <code>VirtualHost</code> directive
+ listing the IP address and port combibation that was determined
+ to be the best match, no further actions are performed and
+ the request is served from the matching vhost.</p>
</section>
<section id="namebased"><title>Name-based vhost</title>
- <p>If the entry corresponds to a name-based vhost, the "list" in
- the remaining steps refers to the list of vhosts that matched, in
- the order they were in the configuration file.</p>
+ <p>If there are multiple <code>VirtalHost</code> directives listing
+ the IP address and port combination that was determined to be the
+ best match, the "list" in the remaining steps refers to the list of vhosts
+ that matched, in the order they were in the configuration file.</p>
<p>If the connection is using SSL, the server supports <glossary
ref="servernameindication">Server Name Indication</glossary>, and
@@ -324,20 +250,18 @@
<section id="observations"><title>Observations</title>
<ul>
- <li>A name-based vhost can never interfere with an IP-base
- vhost and vice versa. IP-based vhosts can only be reached
- through an IP address of its own address set and never
- through any other address. The same applies to name-based
- vhosts, they can only be reached through an IP address of the
- corresponding address set which must be defined with a
- <code>NameVirtualHost</code> directive.</li>
-
- <li><code>ServerAlias</code>
+ <li>Name-based virtual hosting is a process applied after
+ the server has selected the best matching IP-based virtual
+ host.</li>
+
+ <li>If you don't care what IP address the client has connected to, use a
+ "*" as the address of every virtual host, and name-based virtual hosting
+ is applied across all configured virtual hosts.</li>
+
+ <li><code>ServerName</code> and <code>ServerAlias</code>
checks are never performed for an IP-based vhost.</li>
- <li>The order of name-/IP-based, the <code>_default_</code>
- vhost and the <code>NameVirtualHost</code> directive within
- the config file is not important. Only the ordering of
+ <li>Only the ordering of
name-based vhosts for a specific address set is significant.
The one name-based vhosts that comes first in the
configuration file has the highest priority for its
@@ -347,39 +271,18 @@
matching process. Apache always uses the real port to which
the client sent the request.</li>
- <li>If two IP-based vhosts have an address in common, the
- vhost appearing first in the config file is always matched.
- Such a thing might happen inadvertently. The server will give
- a warning in the error logfile when it detects this.</li>
-
- <li>A <code>_default_</code> vhost catches a request only if
- there is no other vhost with a matching IP address
- <em>and</em> a matching port number for the request. The
- request is only caught if the port number to which the client
- sent the request matches the port number of your
- <code>_default_</code> vhost which is your standard
- <code>Listen</code> by default. A wildcard port can be
- specified (<em>i.e.</em>, <code>_default_:*</code>) to catch
- requests to any available port. This also applies to
- <code>NameVirtualHost *</code> vhosts. Note that this is simply an
- extension of the "best match" principle, as a specific and exact match
- is favored over a wildcard.</li>
+ <li>If two vhosts have an address in common, those common addresses
+ act as name-based virtual hosts implicitly. This is new behavior as of
+ 2.3.11.</li>
<li>The main server is only used to serve a request if the IP
address and port number to which the client connected
does not match any vhost (including a
- <code>_default_</code> vhost). In other words, the main server
+ <code>*</code> vhost). In other words, the main server
only catches a request for an unspecified address/port
combination (unless there is a <code>_default_</code> vhost
which matches that port).</li>
- <li>A <code>_default_</code> vhost or the main server is
- <em>never</em> matched for a request with an unknown or
- missing <code>Host:</code> header field if the client
- connected to an address (and port) which is used for
- name-based vhosts, <em>e.g.</em>, in a
- <code>NameVirtualHost</code> directive.</li>
-
<li>You should never specify DNS names in
<code>VirtualHost</code> directives because it will force
your server to rely on DNS to boot. Furthermore it poses a
@@ -408,10 +311,6 @@
readability of the configuration -- the post-config merging
process makes it non-obvious that definitions mixed in around
virtual hosts might affect all virtual hosts.)</li>
-
- <li>Group corresponding <code>NameVirtualHost</code> and
- <code>VirtualHost</code> definitions in your configuration to
- ensure better readability.</li>
</ul>
</section>
diff --git a/docs/manual/vhosts/examples.xml b/docs/manual/vhosts/examples.xml
index ef6ec3010f..4a70b5a979 100644
--- a/docs/manual/vhosts/examples.xml
+++ b/docs/manual/vhosts/examples.xml
@@ -59,8 +59,6 @@
# Ensure that Apache listens on port 80<br />
Listen 80<br />
<br />
- # Listen for virtual host requests on all IP addresses<br />
- NameVirtualHost *:80<br />
<br />
&lt;VirtualHost *:80&gt;<br />
<indent>
@@ -95,17 +93,9 @@
<note>
<title>Note</title>
- <p>You can, if you wish, replace <code>*</code> with the actual
- IP address of the system. In that case, the argument to
- <code>VirtualHost</code> <em>must</em> match the argument to
- <code>NameVirtualHost</code>:</p>
-
- <example>
- NameVirtualHost 172.20.30.40<br />
- <br />
- &lt;VirtualHost 172.20.30.40&gt;<br />
- # etc ...
- </example>
+ <p>You can, if you wish, replace <code>*</code> with the actual
+ IP address of the system, when you don't care to discriminate based
+ on the IP address or port.</p>
<p>However, it is additionally useful to use <code>*</code>
on systems where the IP address is not predictable - for
@@ -145,9 +135,6 @@
ServerName server.example.com<br />
DocumentRoot /www/mainserver<br />
<br />
- # This is the other address<br />
- NameVirtualHost 172.20.30.50<br />
- <br />
&lt;VirtualHost 172.20.30.50&gt;<br />
<indent>
DocumentRoot /www/example1<br />
@@ -195,8 +182,6 @@
<example>
<title>Server configuration</title>
- NameVirtualHost 192.168.1.1<br />
- NameVirtualHost 172.20.30.40<br />
<br />
&lt;VirtualHost 192.168.1.1 172.20.30.40&gt;<br />
<indent>
@@ -227,10 +212,9 @@
ports.</title>
<p>You have multiple domains going to the same IP and also want to
- serve multiple ports. By defining the ports in the "NameVirtualHost"
- tag, you can allow this to work. If you try using &lt;VirtualHost
- name:port&gt; without the NameVirtualHost name:port or you try to use
- the Listen directive, your configuration will not work.</p>
+ serve multiple ports. The example below illustrates that the name-matching
+ takes place after the best matching IP address and port combination
+ is determined.</p>
<example>
<title>Server configuration</title>
@@ -238,9 +222,6 @@
Listen 80<br />
Listen 8080<br />
<br />
- NameVirtualHost 172.20.30.40:80<br />
- NameVirtualHost 172.20.30.40:8080<br />
- <br />
&lt;VirtualHost 172.20.30.40:80&gt;<br />
<indent>
ServerName www.example.com<br />
@@ -357,16 +338,13 @@
<section id="mixed"><title>Mixed name-based and IP-based
vhosts</title>
- <p>On some of my addresses, I want to do name-based virtual hosts, and
- on others, IP-based hosts.</p>
+ <p>Any address mentioned in the argument to a virtualhost that never
+ appears in another virtual host is a strictly IP-based virtual host.</p>
<example>
<title>Server configuration</title>
Listen 80<br />
- <br />
- NameVirtualHost 172.20.30.40<br />
- <br />
&lt;VirtualHost 172.20.30.40&gt;<br />
<indent>
DocumentRoot /www/example1<br />
@@ -540,8 +518,6 @@
ServerName www.example.com<br />
DocumentRoot /www/example1<br />
<br />
- NameVirtualHost 172.20.30.40<br />
- <br />
&lt;VirtualHost 172.20.30.40 172.20.30.50&gt;<br />
<indent>
DocumentRoot /www/example2<br />
@@ -581,8 +557,6 @@
<example>
<title>Server configuration</title>
- NameVirtualHost 172.20.30.40<br />
- <br />
&lt;VirtualHost 172.20.30.40&gt;<br />
<indent>
# primary vhost<br />
diff --git a/docs/manual/vhosts/index.xml b/docs/manual/vhosts/index.xml
index fbb2c247fe..055a404fa4 100644
--- a/docs/manual/vhosts/index.xml
+++ b/docs/manual/vhosts/index.xml
@@ -82,7 +82,6 @@ hosts</a></seealso>
<ul>
<li><directive type="section"
module="core">VirtualHost</directive></li>
- <li><directive module="core">NameVirtualHost</directive></li>
<li><directive module="core">ServerName</directive></li>
<li><directive module="core">ServerAlias</directive></li>
<li><directive module="core">ServerPath</directive></li>
diff --git a/docs/manual/vhosts/ip-based.xml b/docs/manual/vhosts/ip-based.xml
index 24196c0e4d..9fde89fe51 100644
--- a/docs/manual/vhosts/ip-based.xml
+++ b/docs/manual/vhosts/ip-based.xml
@@ -28,6 +28,18 @@
<a href="name-based.html">Name-based Virtual Hosts Support</a>
</seealso>
+<section id="explanation"><title>What is IP-based virtual hosting</title>
+<p>IP-based virtual hosting is a method to apply different directives
+based on the IP address and port a request is received on. Most commonly,
+this is used to serve different websites on different ports or interfaces.</p>
+
+<p>In many cases, <a href="name-based.html">name-based
+virtual hosts</a> are more convenient, because they allow
+many virtual hosts to share a single address/port.
+See <a href="name-based.html#namevip">Name-based vs. IP-based
+Virtual Hosts</a> to help you decide. </p>
+</section>
+
<section id="requirements"><title>System requirements</title>
<p>As the term <cite>IP-based</cite> indicates, the server
@@ -40,12 +52,8 @@
most commonly used to set them up), and/or using multiple
port numbers.</p>
- <p>In many cases, <a href="name-based.html">name-based
- virtual hosts</a> are more convenient, because they allow
- many virtual hosts to share a single address/port.
- See <a href="name-based.html#namevip">Name-based vs. IP-based
- Virtual Hosts</a> to help you decide.
- </p>
+ <p> In the terminology of Apache HTTP Servr, using a single IP address
+ but multiple TCP ports, is also IP-based virtual hosting.</p>
</section>
@@ -147,6 +155,10 @@
hostname in the &lt;VirtualHost&gt; directive
(see <a href="../dns-caveats.html">DNS caveats</a>).</p>
+ <p> Specific IP addresses or ports have precedence over their wildcard
+ equivalents, and any virtual host that matches has precedence over
+ the servers base configuration.</p>
+
<p>Almost <strong>any</strong> configuration directive can be
put in the VirtualHost directive, with the exception of
directives that control process creation and a few other
diff --git a/docs/manual/vhosts/mass.xml b/docs/manual/vhosts/mass.xml
index 4755130667..227e95fb50 100644
--- a/docs/manual/vhosts/mass.xml
+++ b/docs/manual/vhosts/mass.xml
@@ -43,7 +43,6 @@
<example>
<pre>
-NameVirtualHost 111.22.33.44
&lt;VirtualHost 111.22.33.44&gt;
ServerName customer-1.example.com
DocumentRoot /www/hosts/customer-1.example.com/docs
diff --git a/docs/manual/vhosts/name-based.xml b/docs/manual/vhosts/name-based.xml
index 476547d355..1ff58e0875 100644
--- a/docs/manual/vhosts/name-based.xml
+++ b/docs/manual/vhosts/name-based.xml
@@ -62,6 +62,10 @@
they are on separate IP addresses.</li>
</ul>
+ <p> Name-based virtual hosting builds off of the IP-based virtual host
+ selection algoirthm, meaning that searches for the proper server name
+ occur only between virtual hosts that have the best IP-based address.</p>
+
</section>
@@ -71,23 +75,22 @@
host resolution is IP-based resolution. Name-based virtual host
resolution only chooses the most appropriate name-based virtual host
after narrowing down the candidates to the best IP-based match. Using a wildcard (*)
- for the IP address in all of the NameVirtualHost and VirtualHost directives makes this
+ for the IP address in all of the VirtualHost directives makes this
IP-based mapping irrelevant.</p>
- <p>When a request arrives, the server will first check if it is using
- an IP address that matches exactly any <directive module="core"
- >NameVirtualHost</directive>. If it is, then it will look at each <directive
- type="section" module="core">VirtualHost</directive> section with a (literal) matching
- IP address and try to find one where the <directive module="core"
- >ServerName</directive> or <directive module="core" >ServerAlias</directive>
- matches the requested hostname. If it finds one, then it uses the configuration
- for that server.</p>
-
- <section id="defaultvhost"><title>The default name-based vhost for a NameVirtualHost</title>
- <p> If no matching ServerName or ServerAlias is found in the
- set of virtual hosts matching the NameVirtualHost directive, then
- <strong>the first listed virtual host</strong> that matches the IP
- address will be used.</p></section>
+ <p>When a request arrives, the server will find the best (most specific) matching
+ <directive type="section" module="core">VirtualHost</directive> argument based on
+ the IP address and port used by the request. If there is more than one virtual host
+ contanin this best-match address and port combination, Apache will further
+ compare the <directive module="core" >ServerName</directive> and <directive
+ module="core">ServerAlias</directive> directives to the server name
+ present in the request.</p>
+
+ <section id="defaultvhost"><title>The default name-based vhost for an IP and port combination </title>
+ <p> If no matching ServerName or ServerAlias is found in the set of
+ virtual hosts containing the most specific matching IP address and port
+ combination, then <strong>the first listed virtual host</strong> that
+ matches the will be used.</p></section>
</section>
<section id="using"><title>Using Name-based Virtual Hosts</title>
@@ -99,38 +102,15 @@
<directivelist>
<directive module="core">DocumentRoot</directive>
- <directive module="core">NameVirtualHost</directive>
<directive module="core">ServerAlias</directive>
<directive module="core">ServerName</directive>
<directive module="core" type="section">VirtualHost</directive>
</directivelist>
</related>
- <p>To use name-based virtual hosting, you must designate the IP
- address (and possibly port) on the server that will be accepting
- requests that need to be distinguished by hostname.
- This is configured using the <directive
- module="core">NameVirtualHost</directive> directive.
- In the normal case where any and all IP addresses on the server should
- be used, you can use <code>*</code> as the argument to <directive
- module="core">NameVirtualHost</directive>. If you're planning to use
- multiple ports (e.g. running SSL) you should add a Port to the argument,
- such as <code>*:80</code>.</p>
-
- <note><p>Note that mentioning an IP address in a
- <directive module="core">NameVirtualHost</directive> directive does not
- automatically make the server <em>listen</em> to that IP address. See
- <a href="../bind.html">Setting which addresses and ports Apache uses</a>
- for more details. In addition, any IP address specified here must be
- associated with a network interface on the server.</p></note>
-
- <p>The next step is to create a <directive type="section"
+ <p>The first step is to create a <directive type="section"
module="core">VirtualHost</directive> block for
- each different host that you would like to serve. The argument to the
- <directive type="section" module="core">VirtualHost</directive> directive
- must match a defined <directive
- module="core">NameVirtualHost</directive> directive. (In this usual case,
- this will be "*:80"). Inside each <directive type="section"
+ each different host that you would like to serve. Inside each <directive type="section"
module="core">VirtualHost</directive> block, you will need at minimum a
<directive module="core">ServerName</directive> directive to designate
which host is served and a <directive module="core">DocumentRoot</directive>
@@ -158,8 +138,6 @@
Then you simply add the following to <code>httpd.conf</code>:</p>
<example>
- NameVirtualHost *:80<br />
- <br />
&lt;VirtualHost *:80&gt;<br />
<indent>
# This first-listed virtual host is also the default for *:80
@@ -177,8 +155,7 @@
</example>
<p>You can alternatively specify an explicit IP address in place of the
- <code>*</code> in both the <directive module="core"
- >NameVirtualHost</directive> and <directive type="section" module="core"
+ <code>*</code> in <directive type="section" module="core"
>VirtualHost</directive> directives. For example, you might want to do this
in order to run some name-based virtual hosts on one IP address, and either
IP-based, or another set of name-based virtual hosts on another address.</p>