mirror of
https://github.com/apache/httpd.git
synced 2025-07-05 16:21:14 +03:00
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1828650 13f79535-47bb-0310-9956-ffa450edef68
240 lines
11 KiB
XML
240 lines
11 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
|
|
<?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
|
|
<!-- English Revision: 1330964:1828172 (outdated) -->
|
|
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
this work for additional information regarding copyright ownership.
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
(the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<modulesynopsis metafile="mod_cgi.xml.meta">
|
|
|
|
<name>mod_cgi</name>
|
|
<description>CGI スクリプトの実行</description>
|
|
<status>Base</status>
|
|
<sourcefile>mod_cgi.c</sourcefile>
|
|
<identifier>cgi_module</identifier>
|
|
|
|
<summary>
|
|
<p>ハンドラ <code>cgi-script</code>
|
|
が指定されているファイルは CGI スクリプトとして扱われ、
|
|
サーバにより実行され、その出力がクライアントに返されます。
|
|
ファイルは、<directive module="mod_mime">AddHandler</directive>
|
|
ディレクティブに指定された 拡張子を名前に含むか、
|
|
<directive module="mod_alias">ScriptAlias</directive>
|
|
ディレクトリに存在することによりこのハンドラになります。</p>
|
|
|
|
<p>Apache で CGI スクリプトを使用するためのイントロダクションは、
|
|
<a href="../howto/cgi.html">CGI による動的コンテンツ</a>
|
|
を参照してください。</p>
|
|
|
|
<p>Unix でマルチスレッドの MPM を使っている場合は、このモジュールの
|
|
代わりに <module>mod_cgid</module> を使う必要があります。
|
|
ユーザレベルではこの二つのモジュールは本質的には同一です。</p>
|
|
|
|
<p>後方互換性のため、 MIME タイプが <code>application/x-httpd-cgi</code>
|
|
であるファイルでも cgi-script ハンドラが有効になります。この特殊な MIME タイプを
|
|
使う方法は非推奨です。</p>
|
|
</summary>
|
|
|
|
<seealso><directive module="core">AcceptPathInfo</directive></seealso>
|
|
<seealso><directive module="core">Options</directive> ExecCGI</seealso>
|
|
<seealso><directive module="mod_alias">ScriptAlias</directive></seealso>
|
|
<seealso><directive module="mod_mime">AddHandler</directive></seealso>
|
|
<seealso><a href="../suexec.html">CGI プログラムを別のユーザ ID で実行する</a></seealso>
|
|
<seealso><a href="http://www.ietf.org/rfc/rfc3875">CGI 規格書</a></seealso>
|
|
|
|
<section id="env"><title>CGI 環境変数</title>
|
|
<p>サーバは <a href="http://www.ietf.org/rfc/rfc3875">CGI
|
|
規格</a> で決められている CGI
|
|
環境変数を設定します。以下のものは、条件付きで設定されます。</p>
|
|
|
|
<dl>
|
|
<dt>PATH_INFO</dt>
|
|
|
|
<dd>これは <directive module="core"
|
|
>AcceptPathInfo</directive> ディレクティブが明示的に <code>off</code>
|
|
に設定されている場合は設定されません。デフォルトの、
|
|
<directive>AcceptPathInfo</directive> が
|
|
指定されていないときの振る舞いでは、<module>mod_cgi</module> はパス情報
|
|
(URI のスクリプトのファイル名の後に続く <code>/more/path/info</code>) を
|
|
受け付けますが、コアはサーバはパス情報のあるリクエストに
|
|
対して 404 NOT FOUND エラーを返します。<directive>AcceptPathInfo</directive>
|
|
ディレクティブを
|
|
省略すると、<module>mod_cgi</module> へのリクエストに対して
|
|
<code>On</code> を
|
|
設定したのと同じ効果になります。</dd>
|
|
|
|
<dt>REMOTE_HOST</dt>
|
|
|
|
<dd><directive module="core">HostnameLookups</directive>
|
|
が <code>on</code> (デフォルトでは off です)
|
|
で、アクセスしているホストのアドレスの DNS
|
|
の逆引きが実際にホスト名を見つけたときにのみ設定されます。</dd>
|
|
|
|
<dt>REMOTE_IDENT</dt>
|
|
|
|
<dd><directive module="mod_ident">IdentityCheck</directive>
|
|
が <code>on</code> に設定されていて、アクセスしているホストが
|
|
ident プロトコルをサポートしているときにのみ設定されます。
|
|
これは簡単に偽ることができ、クライアントとサーバの間に
|
|
プロキシがあればまったく役に立たないので、
|
|
この変数の値は信用できないということに注意してください。
|
|
</dd>
|
|
|
|
<dt>REMOTE_USER</dt>
|
|
|
|
<dd>CGI
|
|
スクリプトに認証が必要なときにのみ設定されます。</dd>
|
|
</dl>
|
|
</section>
|
|
|
|
<section id="cgi-debug"><title>CGI のデバッグ</title>
|
|
<p>CGI スクリプトのデバッグは、正しく動作していないスクリプトの出力
|
|
(標準出力とエラー)
|
|
を調べることができないために、難しい状態が続いていました。
|
|
これらのディレクティブはより詳細なエラーのログ収集を提供します。</p>
|
|
|
|
<section><title>CGI ログファイルの書式</title>
|
|
<p>設定されているときには、CGI エラーログは適切に動作しないすべての
|
|
CGI をログ収集します。それぞれの正しく動作しない CGI
|
|
スクリプトは 複数の行にわたる情報がログ収集されます。最初の
|
|
2 行は常に以下の書式です:</p>
|
|
|
|
<example>
|
|
%% [<var>time</var>] <var>request-line</var><br />
|
|
%% <var>HTTP-status</var> <var>CGI-script-filename</var>
|
|
</example>
|
|
|
|
<p>エラーが、CGI スクリプトが実行できないというものである場合は、
|
|
ログファイルはさらにもう 2 行書かれます:</p>
|
|
|
|
<example>
|
|
%%error<br />
|
|
<var>error-message</var>
|
|
</example>
|
|
|
|
<p>そうではなく、エラーが正しくないヘッダ情報を返す結果である場合
|
|
(スクリプトのバグであることがよくあります)、
|
|
以下の情報がログ収集されます:</p>
|
|
|
|
<example>
|
|
%request<br />
|
|
<var>受け取ったすべての HTTP リクエストヘッダ</var><br />
|
|
<var>(もしあれば) POST や PUT の中身</var><br />
|
|
%response<br />
|
|
<var>CGI スクリプトにより出力されたすべてのヘッダ</var><br />
|
|
%stdout<br />
|
|
<var>CGI 標準出力</var><br />
|
|
%stderr<br />
|
|
<var>CGI 標準エラー</var><br />
|
|
</example>
|
|
|
|
<p>(スクリプトが標準出力や標準エラーに何も出力しなかった場合は、
|
|
%stdout や %stderr はありません)。</p>
|
|
</section>
|
|
</section>
|
|
|
|
<directivesynopsis>
|
|
<name>ScriptLog</name>
|
|
<description>CGI スクリプトのエラーログファイルの場所</description>
|
|
<syntax>ScriptLog <var>file-path</var></syntax>
|
|
<contextlist><context>server config</context>
|
|
<context>virtual host</context>
|
|
</contextlist>
|
|
<modulelist><module>mod_cgi</module><module>mod_cgid</module>
|
|
</modulelist>
|
|
|
|
<usage>
|
|
<p><directive>ScriptLog</directive> ディレクティブは CGI スクリプトの
|
|
エラーログファイルを設定します。<directive>ScriptLog</directive> が
|
|
設定されていないときは、
|
|
エラーログは作成されません。設定されているときは、CGI
|
|
のエラーはすべて引数として与えられているファイル名にログされます。
|
|
相対パスで指定されているときは、
|
|
<directive module="core">ServerRoot</directive>からの相対パスとして
|
|
扱われます。</p>
|
|
|
|
<example><title>例</title>
|
|
<highlight language="config">
|
|
ScriptLog logs/cgi_log
|
|
</highlight>
|
|
</example>
|
|
|
|
<p>このログは子プロセスが実行されているユーザとしてオープンされます。
|
|
<em>すなわち</em>、<directive module="mod_unixd"
|
|
>User</directive> ディレクティブで指定された
|
|
ユーザです。これは、スクリプトログが書かれるディレクトリがそのユーザで
|
|
書き込み可能か、スクリプトファイルが手動で作成され、そのユーザで
|
|
書き込み可能になっている必要があるということです。スクリプトログを
|
|
アクセスログなどのためのログディレクトリに書かれるようにしたときは、
|
|
そのディレクトリを子プロセスを実行しているユーザの権限で
|
|
書き込み可能には<strong>しない</strong>ようにしてください。</p>
|
|
|
|
<p>スクリプトのログ収集は CGI スクリプトを書くときの
|
|
デバッグ用の機能として意図されていて、通常のサーバで
|
|
常に使用されるようには意図されていないということに注意してください。
|
|
速度や効率は最適化されておらず、設計された以外の方法で使用されると
|
|
セキュリティの問題があるかもしれません。</p>
|
|
</usage>
|
|
</directivesynopsis>
|
|
|
|
<directivesynopsis>
|
|
<name>ScriptLogLength</name>
|
|
<description>CGI スクリプトのログファイルの大きさの上限</description>
|
|
<syntax>ScriptLogLength <var>bytes</var></syntax>
|
|
<default>ScriptLogLength 10385760</default>
|
|
<contextlist><context>server config</context>
|
|
<context>virtual host</context>
|
|
</contextlist>
|
|
<modulelist><module>mod_cgi</module><module>mod_cgid</module>
|
|
</modulelist>
|
|
|
|
<usage>
|
|
<p><directive>ScriptLogLength</directive> は CGI スクリプトのログファイル
|
|
の大きさを制限するために使用することができます。ログファイルは
|
|
CGI のエラー毎に大量の情報 (リクエストのすべてのヘッダ、
|
|
すべての出力)をログしますので、すぐに大きなファイルになります。
|
|
この大きさの制限がないことによる問題を防ぐために、
|
|
このディレクティブを使って CGI のログファイルの
|
|
最大のファイルサイズを設定することができます。
|
|
ファイルがこの大きさを超えた場合は、それ以上は書き込まれません。</p>
|
|
</usage>
|
|
</directivesynopsis>
|
|
|
|
<directivesynopsis>
|
|
<name>ScriptLogBuffer</name>
|
|
<description>スクリプトログに記録される PUT や POST リクエストの内容の上限</description>
|
|
<syntax>ScriptLogBuffer <em>bytes</em></syntax>
|
|
<default>ScriptLogBuffer 1024</default>
|
|
<contextlist><context>server config</context>
|
|
<context>virtual host</context>
|
|
</contextlist>
|
|
<modulelist><module>mod_cgi</module><module>mod_cgid</module>
|
|
</modulelist>
|
|
|
|
<usage>
|
|
<p>大きな本体を受け取ったときにログファイルがすぐに大きくなりすぎる
|
|
問題を避けるために、ファイルにログ収集される PUT と POST
|
|
の本体の大きさは制限されています。デフォルトでは、1024
|
|
バイトまでがログ収集されますが、
|
|
このディレクティブはそれを変更することができます。
|
|
</p>
|
|
</usage>
|
|
</directivesynopsis>
|
|
|
|
</modulesynopsis>
|