From 5b7f6a5934a28559685756dc58582d83a0f85a46 Mon Sep 17 00:00:00 2001 From: Yoshiki Hayashi Date: Thu, 16 May 2002 07:41:48 +0000 Subject: [PATCH] New Japanese translation. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95134 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/env.html | 350 ------------------------------------ docs/manual/env.html.ja.jis | 344 +++++++++++++++++++++++++++++++++++ 2 files changed, 344 insertions(+), 350 deletions(-) delete mode 100644 docs/manual/env.html create mode 100644 docs/manual/env.html.ja.jis diff --git a/docs/manual/env.html b/docs/manual/env.html deleted file mode 100644 index f030a9df20..0000000000 --- a/docs/manual/env.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - Environment Variables in Apache - - - - - - -

Environment Variables in Apache

- -

The Apache HTTP Server provides a mechanism for storing - information in named variables that are called environment - variables. This information can be used to control various - operations such as logging or access control. The variables are - also used as a mechanism to communicate with external programs - such as CGI scripts. This document discusses different ways to - manipulate and use these variables.

- -

Although these variables are referred to as environment - variables, they are not the same as the environment - variables controlled by the underlying operating system. - Instead, these variables are stored and manipulated in an - internal Apache structure. They only become actual operating - system environment variables when they are provided to CGI - scripts and Server Side Include scripts. If you wish to - manipulate the operating system environment under which the - server itself runs, you must use the standard environment - manipulation mechanisms provided by your operating system - shell.

- - -
- -

Setting Environment - Variables

- - - - - - - -
Related Modules
-
- mod_env
- mod_rewrite
- mod_setenvif
- mod_unique_id
-
Related Directives
-
- BrowserMatch
- BrowserMatchNoCase
- PassEnv
- RewriteRule
- SetEnv
- SetEnvIf
- SetEnvIfNoCase
- UnsetEnv
-
- -

Basic Environment Manipulation

- -

The most basic way to set an environment variable in Apache - is using the unconditional SetEnv directive. - Variables may also be passed from the environment of the shell - which started the server using the PassEnv - directive.

- -

Conditional Per-Request Settings

- -

For additional flexibility, the directives provided by - mod_setenvif allow environment variables to be set on a - per-request basis, conditional on characteristics of particular - requests. For example, a variable could be set only when a - specific browser (User-Agent) is making a request, or only when - a specific Referer [sic] header is found. Even more flexibility - is available through the mod_rewrite's RewriteRule - which uses the [E=...] option to set environment - variables.

- -

Unique Identifiers

- -

Finally, mod_unique_id sets the environment variable - UNIQUE_ID for each request to a value which is - guaranteed to be unique across "all" requests under very - specific conditions.

- -

Standard CGI Variables

- -

In addition to all environment variables set within the - Apache configuration and passed from the shell, CGI scripts and - SSI pages are provided with a set of environment variables - containing meta-information about the request as required by - the CGI - specification.

- -

Some Caveats

- - -
- -

Using Environment - Variables

- - - - - - - -
Related Modules
-
- mod_access
- mod_cgi
- mod_headers
- mod_include
- mod_log_config
- mod_rewrite
-
Related Directives
-
- Allow
- CustomLog
- Deny
- Header
- LogFormat
- RewriteCond
- RewriteRule
-
- -

CGI Scripts

- -

One of the primary uses of environment variables is to - communicate information to CGI scripts. As discussed above, the - environment passed to CGI scripts includes standard - meta-information about the request in addition to any variables - set within the Apache configuration. For more details, see the - CGI tutorial.

- -

SSI Pages

- -

Server-parsed (SSI) documents processed by mod_include's - INCLUDES filter can print environment variables - using the echo element, and can use environment - variables in flow control elements to makes parts of a page - conditional on characteristics of a request. Apache also - provides SSI pages with the standard CGI environment variables - as discussed above. For more details, see the SSI tutorial.

- -

Access Control

- -

Access to the server can be controlled based on the value of - environment variables using the allow from env= - and deny from env= directives. In combination with - SetEnvIf, this allows for flexible control of - access to the server based on characteristics of the client. - For example, you can use these directives to deny access to a - particular browser (User-Agent).

- -

Conditional Logging

- -

Environment variables can be logged in the access log using - the LogFormat option %e. In addition, - the decision on whether or not to log requests can be made - based on the status of environment variables using the - conditional form of the CustomLog directive. In - combination with SetEnvIf this allows for flexible - control of which requests are logged. For example, you can - choose not to log requests for filenames ending in - gif, or you can choose to only log requests from - clients which are outside your subnet.

- -

Conditional Response Headers

- -

The Header directive can use the presence or - absence of an environment variable to determine whether or not - a certain HTTP header will be placed in the response to the - client. This allows, for example, a certain response header to - be sent only if a corresponding header is received in the - request from the client.

- -

URL Rewriting

- -

The %{ENV:...} form of TestString in - the RewriteCond allows mod_rewrite's rewrite - engine to make decisions conditional on environment variables. - Note that the variables accessible in mod_rewrite without the - ENV: prefix are not actually environment - variables. Rather, they are variables special to mod_rewrite - which cannot be accessed from other modules.

-
- -

Special Purpose Environment - Variables

- -

Interoperability problems have led to the introduction of - mechanisms to modify the way Apache behaves when talking to - particular clients. To make these mechanisms as flexible as - possible, they are invoked by defining environment variables, - typically with BrowserMatch, - though SetEnv and PassEnv could also be used, - for example.

- -

downgrade-1.0

- -

This forces the request to be treated as a HTTP/1.0 request - even if it was in a later dialect.

- -

force-no-vary

- -

This causes any Vary fields to be removed from - the response header before it is sent back to the client. Some - clients don't interpret this field correctly (see the known client - problems page); setting this variable can work around this - problem. Setting this variable also implies - force-response-1.0.

- -

force-response-1.0

- -

This forces an HTTP/1.0 response when set. It was originally - implemented as a result of a problem with AOL's proxies. Some - clients may not behave correctly when given an HTTP/1.1 - response, and this can be used to interoperate with them.

- -

nokeepalive

- -

This disables KeepAlive when set.

- -

redirect-carefully

- -

This forces the server to be more careful when sending a redirect - to the client. This is typically used when a client has a known - problem handling redirects. This was originally implemented as a - result of a problem with Microsoft's WebFolders software which has - a problem handling redirects on directory resources via DAV - methods.

- -
-

Examples

- -

Changing protocol behavior with misbehaving clients

- -

We recommend that the following lines be included in - httpd.conf to deal with known client problems.

-
-#
-# The following directives modify normal HTTP response behavior.
-# The first directive disables keepalive for Netscape 2.x and browsers that
-# spoof it. There are known problems with these browser implementations.
-# The second directive is for Microsoft Internet Explorer 4.0b2
-# which has a broken HTTP/1.1 implementation and does not properly
-# support keepalive when it is used on 301 or 302 (redirect) responses.
-#
-BrowserMatch "Mozilla/2" nokeepalive
-BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
-
-#
-# The following directive disables HTTP/1.1 responses to browsers which
-# are in violation of the HTTP/1.0 spec by not being able to grok a
-# basic 1.1 response.
-#
-BrowserMatch "RealPlayer 4\.0" force-response-1.0
-BrowserMatch "Java/1\.0" force-response-1.0
-BrowserMatch "JDK/1\.0" force-response-1.0
-
- -

Do not log requests for images in the access log

- -

This example keeps requests for images from appearing in the - access log. It can be easily modified to prevent logging of - particular directories, or to prevent logging of requests - coming from particular hosts.

-
-    SetEnvIf Request_URI \.gif image-request
-    SetEnvIf Request_URI \.jpg image-request
-    SetEnvIf Request_URI \.png image-request
-    CustomLog logs/access_log env=!image-request
-
- -

Prevent "Image Theft"

- -

This example shows how to keep people not on your server - from using images on your server as inline-images on their - pages. This is not a recommended configuration, but it can work - in limited circumstances. We assume that all your images are in - a directory called /web/images.

-
-    SetEnvIf Referer "^http://www.example.com/" local_referal
-    # Allow browsers that do not send Referer info
-    SetEnvIf Referer "^$" local_referal
-    <Directory /web/images>
-       Order Deny,Allow
-       Deny from all
-       Allow from env=local_referal
-    </Directory>
-
- -

For more information about this technique, see the - ApacheToday tutorial " - Keeping Your Images from Adorning Other Sites".

- - - - diff --git a/docs/manual/env.html.ja.jis b/docs/manual/env.html.ja.jis new file mode 100644 index 0000000000..94e1f58a36 --- /dev/null +++ b/docs/manual/env.html.ja.jis @@ -0,0 +1,344 @@ + + + + + + + + Apache の環境変数 + + + + + + +

Apache における環境変数

+ +

Apache HTTP サーバは環境変数と呼ばれる、名前のついた + 変数に情報を記憶する仕組みを提供しています。この情報はログ収集や + アクセス制御などのいろいろな操作を制御するために使うことができます。 + これらの変数は CGI スクリプトなどの外部プログラムと通信するためにも + 使われます。この文書はそれらの変数の操作方法と使用方法をいくつか + 紹介します。

+ + +

これらの変数は環境変数と呼ばれていますが、オペレーティング + システムによって制御されている環境変数と同じではありません。 + 実際は、これらの変数は Apache の内部構造の中に記憶され、操作されています。 + それらは、CGI や SSI スクリプトに渡されたときだけ、実際の + オペレーティングシステムの環境変数になります。サーバ自身が + 実行されているオペレーティングシステムの環境を操作したい場合は、 + オペレーティングシステムのシェルが提供している標準の環境変数の + 操作方法を使わなければなりません。

+ + +
+ +

環境変数の設定

+ + + + + + + + +
関連モジュール
+
+ mod_env
+ mod_rewrite
+ mod_setenvif
+ mod_unique_id
+
関連ディレクティブ
+
+ BrowserMatch
+ BrowserMatchNoCase
+ PassEnv
+ RewriteRule
+ SetEnv
+ SetEnvIf
+ SetEnvIfNoCase
+ UnsetEnv
+
+ +

基本的な環境の操作

+ +

Apache において環境変数を設定する一番基本的な方法は、 + 無条件に環境変数を設定する SetEnv + ディレクティブを使用することです。 PassEnv + ディレクティブにより、Apache が起動されたシェルの + 環境変数を渡すこともできます。

+ +

リクエスト毎に条件に基づいて設定する

+ +

より柔軟性を高めるために、mod_setenvif + で提供されているディレクティブを使用することで、リクエストの + 特性に基づいて環境変数を設定することができます。例えば、特定のブラウザ + (User-Agent) のリクエストや特定の Referer [意図的な綴りです] + (訳注: 正しい綴りは referrer ですが、HTTP の仕様では Referer + となっています) ヘッダが見つかったときのみ変数を設定することができます。 + mod_rewrite の RewriteRule ディレクティブにおいて + 環境変数を設定する [E=...] オプションを使用することで、 + より柔軟な設定を行なうことができます。

+ +

一意な識別子

+ +

mod_unique_id は、非常に限られた条件の下で + 「すべて」のリクエストについて、一意であることが保証されている値を環境変数 + UNIQUE_ID に設定します。 +

+ +

標準 CGI 変数

+ +

Apache の設定ファイルで設定された環境変数とシェルから渡される + 環境変数に加えて、CGI スクリプトと SSI ページには CGI の仕様で要求されている、 + リクエストのメタ情報を持った環境変数の組が提供されます。 +

+ +

いくつかの注意

+ + +
+ +

環境変数の使用

+ + + + + + + + +
関連モジュール
+
+ mod_access
+ mod_cgi
+ mod_headers
+ mod_include
+ mod_log_config
+ mod_rewrite
+
関連ディレクティブ
+
+ Allow
+ CustomLog
+ Deny
+ Header
+ LogFormat
+ RewriteCond
+ RewriteRule
+
+ +

CGI スクリプト

+ +

環境変数の主な利用法の一つは、CGI スクリプトに情報を伝えることです。 + 上で説明されているように、CGI スクリプトに渡される環境変数は Apache + の設定により設定される変数に加えて、リクエストの標準のメタ情報を含んでいます。 + 詳細は CGI チュートリアル を参照してください。 +

+ + +

SSI ページ

+ +

+ mod_include の INCLUDES フィルタで処理される + server-parsed (SSI) ドキュメントでは、echo + 要素を使用すると環境変数が出力されます。 + また、ページのある部分がリクエストの性質に応じて変更されるように、 + 環境変数をフロー制御要素で使うことができます。詳細は + SSI チュートリアル を参照してください。 +

+ +

アクセス制御

+ +

allow from env= ディレクティブと deny from env= + ディレクティブを使用して、サーバへのアクセスを環境変数の値で制御することができます。 + SetEnvIf ディレクティブと組み合わせることで、クライアントの特性に基づいて + サーバへのアクセス制御を柔軟に行なうことができるようになります。 + 例えば、これらのディレクティブを使用して、特定のブラウザ (User-Agent) + からのアクセスを拒否することができます。 +

+ +

条件付きログ記録

+ +

+ LogFormat ディレクティブのオプション %e + を使用することで、環境変数をアクセスログに記録することができます。さらに、 + CustomLog ディレクティブの条件分岐式を使用することで、 + 環境変数の値によってリクエストをログに記録するかどうかを決めることができます。 + SetEnvIf ディレクティブと組み合わせることで、 + どのリクエストをログに記録するかを柔軟に制御することが可能になります。例えば、 + gif で終わるファイル名へのリクエストはログに記録しない、 + 違うサブネットのクライアントからのリクエストだけをログに記録する、という選択が可能です。 +

+ +

条件付き応答ヘッダ

+ +

Header ディレクティブは環境変数の存在や不在に + よってクライアントへの応答に特定の HTTP ヘッダを付けるかどうかを + 決めることができます。これにより、例えば、クライアントからのリクエスト + にあるヘッダがある場合にのみ特定の応答ヘッダを送る、というようなことが + できます。

+ +

URL の書き換え

+ +

RewriteCond ディレクティブで評価文字列として + %{ENV:...} 式を指定することで、mod_rewrite + の書き換えエンジンが環境変数に基いて条件分岐を行なうことができます。 + mod_rewrite が使用可能な変数で ENV: が前についていない変数は、 + 実際は環境変数ではないということに注意してください。 + それらは他のモジュールからは使用できない mod_rewrite 用の特別な変数です。 +

+
+ +

特別な目的の環境変数

+ + +

+ 互換性の問題を解決するために、特定のクライアントと通信しているときは + Apache の動作を変更できる機構が導入されました。できるだけ柔軟にするために、 + これらの機構は環境変数を定義することで呼び出されます。普通は、 + BrowserMatch + ディレクティブを使いますが、例えば SetEnv ディレクティブや PassEnv ディレクティブも使用することができます。 +

+ +

downgrade-1.0

+ +

これを指定することで、リクエストが HTTP/1.0 + より新しいプロトコルの場合でも、HTTP/1.0 として扱われます。

+ +

force-no-vary

+ +

応答ヘッダがクライアントに送られる前に Vary + フィールドを取り除きます。 + クライアントの中にはこのフィールドを正しく解釈しないものがあります + (クライアントの既知の問題 + のページを参照してください)。この変数を設定することでその問題を回避 + することができます。この変数を設定すると、force-response-1.0 + が設定されたことになります。

+ +

force-response-1.0

+ +

これが設定されていると、常に HTTP/1.0 での応答になります。この機能は、 + 元々は AOL のプロキシの問題のために実装されました。クライアントの中には、 + HTTP/1.1 の応答を返されると正しく動作しないものがあるかもしれません。 + この機能を使用することで、そのようなクライアントとの間の互換性問題を解決できます。

+ +

nokeepalive

+ +

これが設定されている場合は、KeepAlive を使用しないようにします。

+
+ +

+ +

redirect-carefully

+ +

This forces the server to be more careful when sending a redirect + to the client. This is typically used when a client has a known + problem handling redirects. This was originally implemented as a + result of a problem with Microsoft's WebFolders software which has + a problem handling redirects on directory resources via DAV + methods.

+ +

おかしな挙動をするクライアントに対してプロトコルの動作を変更する

+ +

クライアントに関する既知の問題に対処するために、以下の行を + httpd.conf に入れることを推奨しています。

+
+#
+# The following directives modify normal HTTP response behavior.
+# The first directive disables keepalive for Netscape 2.x and browsers that
+# spoof it. There are known problems with these browser implementations.
+# The second directive is for Microsoft Internet Explorer 4.0b2
+# which has a broken HTTP/1.1 implementation and does not properly
+# support keepalive when it is used on 301 or 302 (redirect) responses.
+#
+BrowserMatch "Mozilla/2" nokeepalive
+BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
+
+#
+# The following directive disables HTTP/1.1 responses to browsers which
+# are in violation of the HTTP/1.0 spec by not being able to grok a
+# basic 1.1 response.
+#
+BrowserMatch "RealPlayer 4\.0" force-response-1.0
+BrowserMatch "Java/1\.0" force-response-1.0
+BrowserMatch "JDK/1\.0" force-response-1.0
+
+ +

画像へのリクエストをアクセスログに記録しない

+ +

この例では、画像へのリクエストがアクセスログに現れないようにします。 + これを変更することで、特定のディレクトリのログ収集をやめたり、 + 特定のホストからのリクエストのログ収集をやめたりすることが簡単にできます。 +

+
+    SetEnvIf Request_URI \.gif image-request
+    SetEnvIf Request_URI \.jpg image-request
+    SetEnvIf Request_URI \.png image-request
+    CustomLog logs/access_log env=!image-request
+
+ +

「画像の盗用」を防ぐ

+ +

この例は、別のサーバにいる人が、あなたのサーバにある画像を + inline 画像として使用することを防ぎます。 + これは推奨されている設定ではありませんが、ある限定された状況では有効です。 + ここでは、すべての画像は /web/images というディレクトリにあると仮定します。 +

+
+    SetEnvIf Referer "^http://www.example.com/" local_referal
+    # Allow browsers that do not send Referer info
+    SetEnvIf Referer "^$" local_referal
+    <Directory /web/images>
+       Order Deny,Allow
+       Deny from all
+       Allow from env=local_referal
+    </Directory>
+
+ +

この手法に関する詳しい情報は ApacheToday のチュートリアル "Keeping Your Images from Adorning Other Sites" + を参照してください。

+ + + -- 2.50.1