From 2f9b207b051081382aa6bca4b51e8d5b704931eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Thu, 20 Apr 2006 15:45:16 +0000 Subject: [PATCH] update transformation git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@395624 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/worker.html.en | 2 +- docs/manual/mod/worker.xml.de | 2 +- docs/manual/mod/worker.xml.es | 2 +- docs/manual/mod/worker.xml.ja | 2 +- docs/manual/vhosts/mass.html.en | 174 ++++++++++++++------------------ docs/manual/vhosts/mass.xml.ko | 2 +- 6 files changed, 78 insertions(+), 106 deletions(-) diff --git a/docs/manual/mod/worker.html.en b/docs/manual/mod/worker.html.en index 4afa46d032b..f48239df2d1 100644 --- a/docs/manual/mod/worker.html.en +++ b/docs/manual/mod/worker.html.en @@ -122,7 +122,7 @@ uses non-default values are specified for these directives, they should appear before other worker directives.

-

In addition to a the set of active child processes, there may +

In addition to the set of active child processes, there may be additional child processes which are terminating but where at least one server thread is still handling an existing client connection. Up to MaxClients terminating processes diff --git a/docs/manual/mod/worker.xml.de b/docs/manual/mod/worker.xml.de index 59cb87d553d..2f78c560ffb 100644 --- a/docs/manual/mod/worker.xml.de +++ b/docs/manual/mod/worker.xml.de @@ -1,7 +1,7 @@ - + + + -Dynamically configured mass virtual hosting - Apache HTTP Server +Dynamically Configured Mass Virtual Hosting - Apache HTTP Server @@ -16,7 +16,7 @@

<-
-Apache > HTTP Server > Documentation > Version 2.0 > Virtual Hosts

Dynamically configured mass virtual hosting

+Apache > HTTP Server > Documentation > Version 2.0 > Virtual Hosts

Dynamically Configured Mass Virtual Hosting

Available Languages:  en  |  ko 

@@ -24,24 +24,23 @@

This document describes how to efficiently serve an - arbitrary number of virtual hosts with Apache 1.3. + arbitrary number of virtual hosts with the Apache httpd webserver.

top
@@ -79,25 +78,25 @@ NameVirtualHost 111.22.33.44

The basic idea is to replace all of the static - <VirtualHost> configuration with a mechanism - that works it out dynamically. This has a number of + <VirtualHost> configurations with a mechanism + that works them out dynamically. This has a number of advantages:

    -
  1. Your configuration file is smaller so Apache starts - faster and uses less memory.
  2. +
  3. Your configuration file is smaller, so Apache starts + more quickly and uses less memory.
  4. Adding virtual hosts is simply a matter of creating the appropriate directories in the filesystem and entries in the DNS - you don't need to reconfigure or restart Apache.
-

The main disadvantage is that you cannot have a different - log file for each virtual host; however if you have very many - virtual hosts then doing this is dubious anyway because it eats - file descriptors. It is better to log to a pipe or a fifo and - arrange for the process at the other end to distribute the logs - to the customers (it can also accumulate statistics, etc.).

+

The main disadvantage is that you cannot have a different log file for + each virtual host; however, if you have many virtual hosts, doing + this can be a bad idea anyway, because of the number of file + descriptors needed. It is better to log to a pipe or a fifo, and arrange for + the process at the other end to distribute the logs to the customers. + (This can also be used to accumulate statistics, etc.).

top
@@ -106,48 +105,47 @@ NameVirtualHost 111.22.33.44

A virtual host is defined by two pieces of information: its IP address, and the contents of the Host: header in the HTTP request. The dynamic mass virtual hosting technique - is based on automatically inserting this information into the + used here is based on automatically inserting this information into the pathname of the file that is used to satisfy the request. This - is done most easily using mod_vhost_alias, - but if you are using a version of Apache up to 1.3.6 then you - must use mod_rewrite. + can be most easily done by using mod_vhost_alias + with Apache 2.0. Alternatively, mod_rewrite can be used. Both of these modules are disabled by default; you must enable one of them when configuring and building Apache if you want to use this technique.

A couple of things need to be `faked' to make the dynamic virtual host look like a normal one. The most important is the - server name which is used by Apache to generate - self-referential URLs, etc. It is configured with the + server name, which is used by Apache to generate + self-referential URLs etc. It is configured with the ServerName directive, and it is available to CGIs via the SERVER_NAME environment variable. The actual value used at run time is controlled by the UseCanonicalName - setting. With UseCanonicalName Off the server name - comes from the contents of the Host: header in the - request. With UseCanonicalName DNS it comes from a + setting. With UseCanonicalName Off, the server name + is taken from the contents of the Host: header in the + request. With UseCanonicalName DNS, it is taken from a reverse DNS lookup of the virtual host's IP address. The former setting is used for name-based dynamic virtual hosting, and the latter is used for IP-based hosting. If Apache cannot work out - the server name because there is no Host: header - or the DNS lookup fails then the value configured with + the server name because there is no Host: header, + or the DNS lookup fails, then the value configured with ServerName is used instead.

The other thing to `fake' is the document root (configured with DocumentRoot and available to CGIs via the DOCUMENT_ROOT environment variable). In a normal - configuration this setting is used by the core module when + configuration, this is used by the core module when mapping URIs to filenames, but when the server is configured to - do dynamic virtual hosting that job is taken over by another + do dynamic virtual hosting, that job must be taken over by another module (either mod_vhost_alias or - mod_rewrite) which has a different way of doing + mod_rewrite), which has a different way of doing the mapping. Neither of these modules is responsible for setting the DOCUMENT_ROOT environment variable so - if any CGIs or SSI documents make use of it they will get a + if any CGIs or SSI documents make use of it, they will get a misleading value.

top
-

Simple dynamic virtual hosts

+

Simple Dynamic Virtual Hosts

This extract from httpd.conf implements the virtual host arrangement outlined in the Motivation section above, but in a @@ -174,12 +172,12 @@ VirtualScriptAlias /www/hosts/%0/cgi-bin

top
-

A virtually hosted homepages system

+

A Virtually Hosted Homepages System

-

This is an adjustment of the above system tailored for an +

This is an adjustment of the above system, tailored for an ISP's homepages server. Using a slightly more complicated - configuration we can select substrings of the server name to - use in the filename so that e.g. the documents for + configuration, we can select substrings of the server name to + use in the filename so that, for example, the documents for www.user.isp.com are found in /home/user/. It uses a single cgi-bin directory instead of one per virtual host.

@@ -200,15 +198,15 @@ ScriptAlias /cgi-bin/ /www/std-cgi/
top
-

Using more than - one virtual hosting system on the same server

+

Using Multiple Virtual + Hosting Systems on the Same Server

-

With more complicated setups you can use Apache's normal +

With more complicated setups, you can use Apache's normal <VirtualHost> directives to control the scope of the various virtual hosting configurations. For - example, you could have one IP address for homepages customers - and another for commercial customers with the following setup. - This can of course be combined with conventional + example, you could have one IP address for general customers' homepages, + and another for commercial customers, with the following setup. + This can, of course, be combined with conventional <VirtualHost> configuration sections.

@@ -255,16 +253,15 @@ LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

top
-

More efficient IP-based virtual hosting

+

More Efficient IP-Based Virtual Hosting

-

After the first example I noted that - it is easy to turn it into an IP-based virtual hosting setup. - Unfortunately that configuration is not very efficient because - it requires a DNS lookup for every request. This can be avoided - by laying out the filesystem according to the IP addresses - themselves rather than the corresponding names and changing the - logging similarly. Apache will then usually not need to work - out the server name and so incur a DNS lookup.

+

The configuration changes suggested to turn the first + example into an IP-based virtual hosting setup result in + a rather inefficient setup. A new DNS lookup is required for every + request. To avoid this overhead, the filesystem can be arranged to + correspond to the IP addresses, instead of to the host names, thereby + negating the need for a DNS lookup. Logging will also have to be adjusted + to fit this system.

# get the server name from the reverse DNS of the IP address
@@ -281,45 +278,20 @@ VirtualScriptAliasIP /www/hosts/%0/cgi-bin

top
-

Using older versions of Apache

- -

The examples above rely on mod_vhost_alias - which appeared after version 1.3.6. If you are using a version - of Apache without mod_vhost_alias then you can - implement this technique with mod_rewrite as - illustrated below, but only for Host:-header-based virtual - hosts.

- -

In addition there are some things to beware of with logging. - Apache 1.3.6 is the first version to include the - %V log format directive; in versions 1.3.0 - 1.3.3 - the %v option did what %V does; - version 1.3.4 has no equivalent. In all these versions of - Apache the UseCanonicalName directive can appear - in .htaccess files which means that customers can - cause the wrong thing to be logged. Therefore the best thing to - do is use the %{Host}i directive which logs the - Host: header directly; note that this may include - :port on the end which is not the case for - %V.

- -
top
-
-

Simple dynamic - virtual hosts using mod_rewrite

+

Simple Dynamic + Virtual Hosts Using mod_rewrite

This extract from httpd.conf does the same thing as the first example. The first - half is very similar to the corresponding part above but with - some changes for backward compatibility and to make the + half is very similar to the corresponding part above, except for + some changes, required for backward compatibility and to make the mod_rewrite part work properly; the second half configures mod_rewrite to do the actual work.

-

There are a couple of especially tricky bits: By default, - mod_rewrite runs before the other URI translation - modules (mod_alias etc.) so if they are used then - mod_rewrite must be configured to accommodate - them. Also, some magic must be performed to do a +

There are a couple of especially tricky bits: by default, + mod_rewrite runs before other URI translation + modules (mod_alias etc.) - so if you wish to use these modules, mod_rewrite must be configured to accommodate + them. Also, some magic is required to do a per-dynamic-virtual-host equivalent of ScriptAlias.

@@ -364,7 +336,7 @@ RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [T=appl
top

A - homepages system using mod_rewrite

+ Homepages System Using mod_rewrite

This does the same thing as the second example.

@@ -393,15 +365,15 @@ ScriptAlias /cgi-bin/ /www/std-cgi/
top
-

Using a separate virtual - host configuration file

+

Using a Separate Virtual + Host Configuration File

-

This arrangement uses more advanced mod_rewrite - features to get the translation from virtual host to document - root from a separate configuration file. This provides more - flexibility but requires more complicated configuration.

+

This arrangement uses more advanced mod_rewrite + features to work out the translation from virtual host to document + root, from a separate configuration file. This provides more + flexibility, but requires more complicated configuration.

-

The vhost.map file contains something like +

The vhost.map file should look something like this:

@@ -411,7 +383,7 @@ www.customer-2.com /www/customers/2
www.customer-N.com /www/customers/N

-

The http.conf contains this:

+

The httpd.conf should contain the following:

RewriteEngine on
diff --git a/docs/manual/vhosts/mass.xml.ko b/docs/manual/vhosts/mass.xml.ko index 0db52dafdfd..5c6f4d4d451 100644 --- a/docs/manual/vhosts/mass.xml.ko +++ b/docs/manual/vhosts/mass.xml.ko @@ -1,7 +1,7 @@ - +