From: Jim Jagielski Date: Tue, 22 Jun 1999 00:51:25 +0000 (+0000) Subject: PR: X-Git-Tag: 1.3.7~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4929c7ee928f423cfafb3dfd21078f1888e16d1;p=thirdparty%2Fapache%2Fhttpd.git PR: Submitted by: Tony Finch Reviewed by: Dean, Randy, Jim, Lars, Martin Obtained from: Add the new mod_vhost_alias.c modules for better mass-hosting. This has been used at Demon Internet with excellent results and basically replaces the "old" method of using mod_rewrite. Big advantage is that adding new vhosts can be done without restarting the server. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83357 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/core.html b/docs/manual/mod/core.html index 148eab5155e..d6c99f43865 100644 --- a/docs/manual/mod/core.html +++ b/docs/manual/mod/core.html @@ -3109,8 +3109,7 @@ a packet is sent. Default: UseCanonicalName on
-Context: server config, virtual host, directory, .htaccess -
+Context: server config, virtual host
Override: Options
@@ -3145,6 +3144,12 @@ for www and once again for www.domain.com). But if UseCanonicalName is set off, then Apache will redirect to http://www/splat/. +

There is a third option, UseCanonicalName DNS, which +is intended for use with mass IP-based virtual hosting to support +ancient clients that do not provide a Host: header. With +this option Apache does a reverse DNS lookup on the server IP address +that the client connected to in order to work out self-referential URLs. +

Warning: if CGIs make assumptions about the values of SERVER_NAME they may be broken by this option. The client is essentially free to give whatever value they want as a hostname. diff --git a/docs/manual/mod/index.html b/docs/manual/mod/index.html index f003071e9f8..4da36552fe1 100644 --- a/docs/manual/mod/index.html +++ b/docs/manual/mod/index.html @@ -113,6 +113,8 @@ mod_log_config module in Apache 1.2 and up

Generate unique request identifier for every request
mod_usertrack Apache 1.2 and up
User tracking using Cookies (replacement for mod_cookies.c) +
mod_vhost_alias Apache 1.3.7 and up +
Support for dynamically configured mass virtual hosting diff --git a/docs/manual/mod/mod_log_config.html b/docs/manual/mod/mod_log_config.html index e9bb199a42c..dfa21e3f27b 100644 --- a/docs/manual/mod/mod_log_config.html +++ b/docs/manual/mod/mod_log_config.html @@ -126,6 +126,7 @@ by the values as follows: %...{FOOBAR}e: The contents of the environment variable FOOBAR %...h: Remote host %...a: Remote IP-address +%...A: Local IP-address %...{Foobar}i: The contents of Foobar: header line(s) in the request sent to the server. %...l: Remote logname (from identd, if supplied) diff --git a/docs/manual/mod/mod_rewrite.html b/docs/manual/mod/mod_rewrite.html index ffd9088e0eb..d68f1b8f30b 100644 --- a/docs/manual/mod/mod_rewrite.html +++ b/docs/manual/mod/mod_rewrite.html @@ -1078,6 +1078,7 @@ AUTH_TYPE
DOCUMENT_ROOT
SERVER_ADMIN
SERVER_NAME
+SERVER_ADDR
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
diff --git a/docs/manual/mod/mod_vhost_alias.html b/docs/manual/mod/mod_vhost_alias.html new file mode 100644 index 00000000000..9b86a07143b --- /dev/null +++ b/docs/manual/mod/mod_vhost_alias.html @@ -0,0 +1,311 @@ + + + +Apache module mod_vhost_alias + + + + +
+ [APACHE DOCUMENTATION] +

+ Apache HTTP Server Version 1.3 +

+
+ +

Module mod_vhost_alias

+ +

+This module is contained in the mod_vhost_alias.c file +and is not compiled in by default. It should be mentioned near the +start of the Configuration file so that it doesn't +override the behaviour of other modules that do filename translation, +e.g. mod_userdir and +mod_alias. It provides +support for dynamically configured mass +virtual hosting. +

+ +

Directory Name Interpolation

+ +

+All the directives in this module interpolate a string into a +pathname. The interpolated string (henceforth called the "name") may +be either the server name (see the +UseCanonicalName +directive for details on how this is determined) or the IP address of +the virtual host on the server in dotted-quad format. The +interpolation is controlled by specifiers inspired by +printf which have a number of formats: +

+
%% +
insert a % +
%p +
insert the port number of the virtual host +
%N.M +
insert (part of) the name +
+

+ +

+N and M are used to specify substrings of +the name. N selects from the dot-separated components of +the name, and M selects characters within whatever +N has selected. M is optional and defaults +to zero if it isn't present; the dot must be present if and only if +M is present. The interpretation is as follows: +

+
0 +
the whole name +
1 +
the first part +
2 +
the second part +
-1 +
the last part +
-2 +
the penultimate part +
2+ +
the second and all subsequent parts +
-2+ +
the penultimate and all preceding parts +
1+ and -1+ +
the same as 0 +
+If N or M is greater than the number of +parts available a single underscore is interpolated. +

+ +

Examples

+ +

+For simple name-based virtual hosts you might use the following +directives in your server configuration file: +

+	UseCanonicalName	Off
+	VirtualDocumentRoot	/usr/local/apache/vhosts/%0
+
+A request for http://www.example.com/directory/file.html +will be satisfied by the file +/usr/local/apache/vhosts/www.example.com/directory/file.html. +

+ +

+For a very large number of virtual hosts it is a good idea to arrange +the files to reduce the size of the vhosts directory. To +do this you might use the following in your configuration file: +

+	UseCanonicalName	Off
+	VirtualDocumentRoot	/usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
+
+A request for http://www.example.isp.com/directory/file.html +will be satisfied by the file +/usr/local/apache/isp.com/e/x/a/example/directory/file.html. +A more even spread of files can be acheived by hashing from the end of +the name, for example: +
+	VirtualDocumentRoot	/u/%3+/%2.-1/%2.-2/%2.-3/%2
+
+The example request would come from +/usr/local/apache/vhosts/isp.com/e/l/p/example/directory/file.html. +Alternatively you might use: +
+	VirtualDocumentRoot	/usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
+
+The example request would come from +/usr/local/apache/vhosts/isp.com/e/x/a/mple/directory/file.html. +

+ +

+For IP-based virtual hosting you might use the following in your +configuration file: +

+	UseCanonicalName DNS
+	VirtualDocumentRootIP	/usr/local/apache/vhost/%1/%2/%3/%4/docs
+	VirtualScriptAliasIP	/usr/local/apache/vhost/%1/%2/%3/%4/cgi-bin
+
+A request for http://www.example.isp.com/directory/file.html +would be satisfied by the file +/usr/local/apache/10/20/30/40/docs/directory/file.html if +the IP address of www.example.com were 10.20.30.40. +A request for http://www.example.isp.com/cgi-bin/script.pl +would be satisfied by executing the program +/usr/local/apache/10/20/30/40/cgi-bin/script.pl. +

+ +

+The LogFormat directives +%V and %A are useful in conjunction with +this module. +

+ +
+ +

Directives

+ +
+ +

VirtualDocumentRoot directive

+

+Syntax: VirtualDocumentRoot interpolated-directory
+Default: None
+Context: server config, virtual host
+Status: Extension
+Module: mod_vhost_alias
+Compatibility: VirtualDocumentRoot is only available in 1.3.5 and later.

+

+The VirtualDocumentRoot directive allows you to determine +where Apache will find your documents based on the value of the server +name. The result of expanding interpolated-directory is used +as the root of the document tree in a similar manner to the +DocumentRoot +directive's argument. If interpolated-directory is +none then VirtaulDocumentRoot is turned off. +This directive cannot be used in the same context as +VirtualDocumentRootIP. +

+
+ +

VirtualDocumentRootIP directive

+

+Syntax: VirtualDocumentRootIP interpolated-directory
+Default: None
+Context: server config, virtual host
+Status: Extension
+Module: mod_vhost_alias
+Compatibility: VirtualDocumentRootIP is only available in 1.3.5 and later.

+

+The VirtualDocumentRootIP directive is like the +VirtualDocumentRoot directive, +except that it uses the IP address of the server end of the connection +instead of the server name. +

+
+ +

VirtualScriptAlias directive

+

+Syntax: VirtualScriptAlias interpolated-directory
+Default: None
+Context: server config, virtual host
+Status: Extension
+Module: mod_vhost_alias
+Compatibility: VirtualScriptAlias is only available in 1.3.5 and later.

+

+The VirtualScriptAlias directive allows you to determine +where Apache will find CGI scripts in a similar manner to +VirtualDocumentRoot +does for other documents. It matches requests for URIs starting +/cgi-bin/, much like +ScriptAlias /cgi-bin/ +would. +

+
+ +

VirtualScriptAliasIP directive

+

+Syntax: VirtualScriptAliasIP interpolated-directory
+Default: None
+Context: server config, virtual host
+Status: Extension
+Module: mod_vhost_alias
+Compatibility: VirtualScriptAliasIP is only available in 1.3.5 and later.

+

+The VirtualScriptAliasIP directibe is like the +VirtualScriptAlias directive, +except that it uses the IP address of the server end of the connection +instead of the server name. +

+
+ +

+ Apache HTTP Server Version 1.3 +

+ +Index +Home + + + diff --git a/docs/manual/vhosts/mass.html b/docs/manual/vhosts/mass.html index 10b763f85a4..2c1b8c6fddb 100644 --- a/docs/manual/vhosts/mass.html +++ b/docs/manual/vhosts/mass.html @@ -15,9 +15,7 @@

Dynamically configured mass virtual hosting

This document describes how to efficiently serve an arbitrary number -of virtual hosts with Apache 1.3. Some familiarity with -mod_rewrite is -useful.

+of virtual hosts with Apache 1.3.