From 9ef6b1aaabf374bed96d18ca231589ad16aa7e64 Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Wed, 4 Nov 2009 14:30:55 +0000 Subject: ServerAlias and Listen accumulate, not supercede. The latter of course is n/a to vhosts! Additional rewording of vhost details. PR48125 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@832759 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/vhosts/details.html.en | 71 ++++++++++++++++---------------------- docs/manual/vhosts/details.xml | 71 ++++++++++++++++---------------------- 2 files changed, 60 insertions(+), 82 deletions(-) (limited to 'docs/manual') diff --git a/docs/manual/vhosts/details.html.en b/docs/manual/vhosts/details.html.en index 534498e1e5..61ab13ae5b 100644 --- a/docs/manual/vhosts/details.html.en +++ b/docs/manual/vhosts/details.html.en @@ -54,49 +54,49 @@ sections.

The directives - Listen, - ServerName, - ServerPath, - and ServerAlias + ServerName and + ServerPath can appear anywhere within the definition of a server. However, each appearance overrides the previous appearance (within that server).

-

The default value of the Listen field for - main_server is 80. The main_server has no default +

The main_server has no default ServerPath, or ServerAlias. The default ServerName is deduced from the server's IP address.

-

The main_server Listen directive has two functions. One - function is to determine the default network port Apache will - bind to. The second function is to specify the port number - which is used in absolute URIs during redirects.

- -

Unlike the main_server, vhost ports do not affect - what ports Apache listens for connections on.

- +

Port numbers specified in the VirtualHost directive do + not influence what port numbers Apache will listen on, they only discriminate between + which VirtualHost will be selected to handle a request.

+

Each address appearing in the VirtualHost directive can have an optional port. If the port is unspecified - it defaults to the value of the main_server's most recent - Listen statement. The special port * + it is treated as a wildcard port. The special port * indicates a wildcard that matches any port. Collectively the entire set of addresses (including multiple A record results from DNS lookups) are called the vhost's address set.

Unless a NameVirtualHost - directive is used for a specific IP address the first vhost - with that address is treated as an IP-based vhost. The IP - address can also be the wildcard *.

- -

If name-based vhosts should be used a + directive is used for the exact IP address and port pair in the + VirtualHost directive, Apache selects the best match + only on the basis of the IP address (or wildcard) and port number. + If there are multiple identical best matches, the first VirtualHost + appearing in the configuration file will be selected.

+ +

If you want Apache to further discriminate on the basis of the + HTTP Host header supplied by the client, the NameVirtualHost directive must appear - with the IP address set to be used for the name-based vhosts. - In other words, you must specify the IP address that holds the - hostname aliases (CNAMEs) for your name-based vhosts via a - NameVirtualHost directive in your configuration - file.

+ with the exact IP address (or wildcard) and port pair used in a correspnding + set of VirtualHost directives.

+ +

The name-based virtual host selection occurs only after the a single IP-based + virtual host has been selected, and only considers the set of virtual hosts + the carry an identical IP address and port pair.

+ +

Hostnames can be used in place of IP addresses in a virtual host definition, + but it is resolved at startup and is not recommended.

+

Multiple NameVirtualHost directives can be used each with a set of VirtualHost directives but only @@ -158,18 +158,6 @@

(To aid the readability of your configuration you should prefer the left variant.)

-

After parsing the VirtualHost directive, the - vhost server is given a default Listen equal to the - port assigned to the first name in its VirtualHost - directive.

- -

The complete list of names in the VirtualHost - directive are treated just like a ServerAlias (but - are not overridden by any ServerAlias statement) - if all names resolve to the same address set. Note that - subsequent Listen statements for this vhost will not - affect the ports assigned in the address set.

-

During initialization a list for each IP address is generated and inserted into an hash table. If the IP address is used in a NameVirtualHost directive the list @@ -349,8 +337,7 @@ configuration file has the highest priority for its corresponding address set. -

  • For security reasons the port number given in a - Host: header field is never used during the +
  • The Host: header field is never used during the matching process. Apache always uses the real port to which the client sent the request.
  • @@ -375,7 +362,9 @@ Listen by default. A wildcard port can be specified (i.e., _default_:*) to catch requests to any available port. This also applies to - NameVirtualHost * vhosts. + NameVirtualHost * vhosts. Note that this is simply an + extension of the "best match" principle, as a specific and exact match + is favored over a wildcard.
  • The main_server is only used to serve a request if the IP address and port number to which the client connected is diff --git a/docs/manual/vhosts/details.xml b/docs/manual/vhosts/details.xml index 00c78deeb2..954d39b03e 100644 --- a/docs/manual/vhosts/details.xml +++ b/docs/manual/vhosts/details.xml @@ -50,49 +50,49 @@ sections.

    The directives - Listen, - ServerName, - ServerPath, - and ServerAlias + ServerName and + ServerPath can appear anywhere within the definition of a server. However, each appearance overrides the previous appearance (within that server).

    -

    The default value of the Listen field for - main_server is 80. The main_server has no default +

    The main_server has no default ServerPath, or ServerAlias. The default ServerName is deduced from the server's IP address.

    -

    The main_server Listen directive has two functions. One - function is to determine the default network port Apache will - bind to. The second function is to specify the port number - which is used in absolute URIs during redirects.

    - -

    Unlike the main_server, vhost ports do not affect - what ports Apache listens for connections on.

    - +

    Port numbers specified in the VirtualHost directive do + not influence what port numbers Apache will listen on, they only discriminate between + which VirtualHost will be selected to handle a request.

    +

    Each address appearing in the VirtualHost directive can have an optional port. If the port is unspecified - it defaults to the value of the main_server's most recent - Listen statement. The special port * + it is treated as a wildcard port. The special port * indicates a wildcard that matches any port. Collectively the entire set of addresses (including multiple A record results from DNS lookups) are called the vhost's address set.

    Unless a NameVirtualHost - directive is used for a specific IP address the first vhost - with that address is treated as an IP-based vhost. The IP - address can also be the wildcard *.

    - -

    If name-based vhosts should be used a + directive is used for the exact IP address and port pair in the + VirtualHost directive, Apache selects the best match + only on the basis of the IP address (or wildcard) and port number. + If there are multiple identical best matches, the first VirtualHost + appearing in the configuration file will be selected.

    + +

    If you want Apache to further discriminate on the basis of the + HTTP Host header supplied by the client, the NameVirtualHost directive must appear - with the IP address set to be used for the name-based vhosts. - In other words, you must specify the IP address that holds the - hostname aliases (CNAMEs) for your name-based vhosts via a - NameVirtualHost directive in your configuration - file.

    + with the exact IP address (or wildcard) and port pair used in a correspnding + set of VirtualHost directives.

    + +

    The name-based virtual host selection occurs only after the a single IP-based + virtual host has been selected, and only considers the set of virtual hosts + the carry an identical IP address and port pair.

    + +

    Hostnames can be used in place of IP addresses in a virtual host definition, + but it is resolved at startup and is not recommended.

    +

    Multiple NameVirtualHost directives can be used each with a set of VirtualHost directives but only @@ -154,18 +154,6 @@

    (To aid the readability of your configuration you should prefer the left variant.)

    -

    After parsing the VirtualHost directive, the - vhost server is given a default Listen equal to the - port assigned to the first name in its VirtualHost - directive.

    - -

    The complete list of names in the VirtualHost - directive are treated just like a ServerAlias (but - are not overridden by any ServerAlias statement) - if all names resolve to the same address set. Note that - subsequent Listen statements for this vhost will not - affect the ports assigned in the address set.

    -

    During initialization a list for each IP address is generated and inserted into an hash table. If the IP address is used in a NameVirtualHost directive the list @@ -345,8 +333,7 @@ configuration file has the highest priority for its corresponding address set.

  • -
  • For security reasons the port number given in a - Host: header field is never used during the +
  • The Host: header field is never used during the matching process. Apache always uses the real port to which the client sent the request.
  • @@ -371,7 +358,9 @@ Listen by default. A wildcard port can be specified (i.e., _default_:*) to catch requests to any available port. This also applies to - NameVirtualHost * vhosts. + NameVirtualHost * vhosts. Note that this is simply an + extension of the "best match" principle, as a specific and exact match + is favored over a wildcard.
  • The main_server is only used to serve a request if the IP address and port number to which the client connected is -- cgit v1.2.3