]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_cgi.xml.ja
Rebuild transformations.
[apache] / docs / manual / mod / mod_cgi.xml.ja
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?>
4 <!-- English Revision: 558718:1061423 (outdated) -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_cgi.xml.meta">
24
25 <name>mod_cgi</name>
26 <description>CGI スクリプトの実行</description>
27 <status>Base</status>
28 <sourcefile>mod_cgi.c</sourcefile>
29 <identifier>cgi_module</identifier>
30
31 <summary>
32     <!-- XXX: Should mention Options ExecCGI
33           is the link to howto/cgi not sufficient? -nd
34     -->
35
36     <p>ハンドラ <code>cgi-script</code>
37     が指定されているファイルは CGI スクリプトとして扱われ、
38     サーバにより実行され、その出力がクライアントに返されます。
39     ファイルは、<directive module="mod_mime">AddHandler</directive>
40     ディレクティブに指定された 拡張子を名前に含むか、
41     <directive module="mod_alias">ScriptAlias</directive>
42     ディレクトリに存在することによりこのハンドラになります。</p>
43
44     <p>Apache で CGI スクリプトを使用するためのイントロダクションは、
45     <a href="../howto/cgi.html">CGI による動的コンテンツ</a>
46     を参照してください。</p>
47
48     <p>Unix でマルチスレッドの MPM を使っている場合は、このモジュールの
49     代わりに <module>mod_cgid</module> を使う必要があります。
50     ユーザレベルではこの二つのモジュールは本質的には同一です。</p>
51
52     <p>後方互換性のため、 MIME タイプが <code>application/x-httpd-cgi</code> 
53     であるファイルでも cgi-script ハンドラが有効になります。この特殊な MIME タイプを
54     使う方法は非推奨です。</p> 
55 </summary>
56
57 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
58 <seealso><directive module="core">Options</directive></seealso>
59 <seealso><directive module="mod_alias">ScriptAlias</directive></seealso>
60 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
61 <seealso><a href="../suexec.html">CGI プログラムを別のユーザ ID で実行する</a></seealso>
62 <seealso><a href="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI 規格書</a></seealso>
63
64 <section id="env"><title>CGI 環境変数</title>
65     <p>サーバは <a href="http://hoohoo.ncsa.uiuc.edu/cgi/">CGI
66     規格</a> で決められている CGI
67     環境変数を設定します。以下のものは、条件付きで設定されます。</p>
68
69     <dl>
70       <dt>PATH_INFO</dt>
71
72       <dd>これは <directive module="core"
73       >AcceptPathInfo</directive> ディレクティブが明示的に <code>off</code>
74       に設定されている場合は設定されません。デフォルトの、
75       <directive>AcceptPathInfo</directive> が
76       指定されていないときの振る舞いでは、<module>mod_cgi</module> はパス情報
77       (URI のスクリプトのファイル名の後に続く <code>/more/path/info</code>) を
78       受け付けますが、コアはサーバはパス情報のあるリクエストに
79       対して 404 NOT FOUND エラーを返します。<directive>AcceptPathInfo</directive>
80       ディレクティブを
81       省略すると、<module>mod_cgi</module> へのリクエストに対して
82       <code>On</code> を
83       設定したのと同じ効果になります。</dd>
84
85       <dt>REMOTE_HOST</dt>
86
87       <dd><directive module="core">HostnameLookups</directive>
88       が <code>on</code> (デフォルトでは off です)
89       で、アクセスしているホストのアドレスの DNS
90       の逆引きが実際にホスト名を見つけたときにのみ設定されます。</dd>
91
92       <dt>REMOTE_IDENT</dt>
93
94       <dd><directive module="core">IdentityCheck</directive>
95       が <code>on</code> に設定されていて、アクセスしているホストが
96       ident プロトコルをサポートしているときにのみ設定されます。
97       これは簡単に偽ることができ、クライアントとサーバの間に
98       プロキシがあればまったく役に立たないので、
99       この変数の値は信用できないということに注意してください。
100       </dd>
101
102       <dt>REMOTE_USER</dt>
103
104       <dd>CGI
105       スクリプトに認証が必要なときにのみ設定されます。</dd>
106     </dl>
107 </section>
108
109 <section id="cgi-debug"><title>CGI のデバッグ</title>
110     <p>CGI スクリプトのデバッグは、正しく動作していないスクリプトの出力
111     (標準出力とエラー)
112     を調べることができないために、難しい状態が続いていました。
113     これらの Apache 1.2 以降にある
114     ディレクティブはより詳細なエラーのログ収集を提供します。</p>
115
116     <section><title>CGI ログファイルの書式</title>
117         <p>設定されているときには、CGI エラーログは適切に動作しないすべての
118         CGI をログ収集します。それぞれの正しく動作しない CGI
119         スクリプトは 複数の行にわたる情報がログ収集されます。最初の
120         2 行は常に以下の書式です:</p>
121
122       <example>
123         %% [<var>time</var>] <var>request-line</var><br />
124         %% <var>HTTP-status</var> <var>CGI-script-filename</var>
125       </example>
126
127       <p>エラーが、CGI スクリプトが実行できないというものである場合は、
128       ログファイルはさらにもう 2 行書かれます:</p>
129
130       <example>
131         %%error<br />
132         <var>error-message</var>
133       </example>
134
135       <p>そうではなく、エラーが正しくないヘッダ情報を返す結果である場合
136       (スクリプトのバグであることがよくあります)、
137       以下の情報がログ収集されます:</p>
138
139     <example>
140       %request<br />
141       <var>受け取ったすべての HTTP リクエストヘッダ</var><br />
142       <var>(もしあれば) POST や PUT の中身</var><br />
143       %response<br />
144       <var>CGI スクリプトにより出力されたすべてのヘッダ</var><br />
145       %stdout<br />
146       <var>CGI 標準出力</var><br />
147       %stderr<br />
148       <var>CGI 標準エラー</var><br />
149     </example>
150
151     <p>(スクリプトが標準出力や標準エラーに何も出力しなかった場合は、
152     %stdout や %stderr はありません)。</p>
153 </section>
154 </section>
155
156 <directivesynopsis>
157 <name>ScriptLog</name>
158 <description>CGI スクリプトのエラーログファイルの場所</description>
159 <syntax>ScriptLog <var>file-path</var></syntax>
160 <contextlist><context>server config</context>
161 <context>virtual host</context>
162 </contextlist>
163 <modulelist><module>mod_cgi</module><module>mod_cgid</module>
164 </modulelist>
165
166 <usage>
167     <p><directive>ScriptLog</directive> ディレクティブは CGI スクリプトの
168     エラーログファイルを設定します。<directive>ScriptLog</directive> が
169     設定されていないときは、
170     エラーログは作成されません。設定されているときは、CGI
171     のエラーはすべて引数として与えられているファイル名にログされます。
172     相対パスで指定されているときは、
173     <directive module="core">ServerRoot</directive>からの相対パスとして
174     扱われます。</p>
175
176     <example><title>例</title>
177       ScriptLog logs/cgi_log
178     </example>
179
180     <p>このログは子プロセスが実行されているユーザとしてオープンされます。
181     <em>すなわち</em>、<directive module="mpm_commmon"
182     >User</directive> ディレクティブで指定された
183     ユーザです。これは、スクリプトログが書かれるディレクトリがそのユーザで
184     書き込み可能か、スクリプトファイルが手動で作成され、そのユーザで
185     書き込み可能になっている必要があるということです。スクリプトログを
186     アクセスログなどのためのログディレクトリに書かれるようにしたときは、
187     そのディレクトリを子プロセスを実行しているユーザの権限で
188     書き込み可能には<strong>しない</strong>ようにしてください。</p>
189
190     <p>スクリプトのログ収集は CGI スクリプトを書くときの
191     デバッグ用の機能として意図されていて、通常のサーバで
192     常に使用されるようには意図されていないということに注意してください。
193     速度や効率は最適化されておらず、設計された以外の方法で使用されると
194     セキュリティの問題があるかもしれません。</p>
195 </usage>
196 </directivesynopsis>
197
198 <directivesynopsis>
199 <name>ScriptLogLength</name>
200 <description>CGI スクリプトのログファイルの大きさの上限</description>
201 <syntax>ScriptLogLength <var>bytes</var></syntax>
202 <default>ScriptLogLength 10385760</default>
203 <contextlist><context>server config</context>
204 <context>virtual host</context>
205 </contextlist>
206 <modulelist><module>mod_cgi</module><module>mod_cgid</module>
207 </modulelist>
208
209 <usage>
210     <p><directive>ScriptLogLength</directive> は CGI スクリプトのログファイル
211     の大きさを制限するために使用することができます。ログファイルは
212     CGI のエラー毎に大量の情報 (リクエストのすべてのヘッダ、
213     すべての出力)をログしますので、すぐに大きなファイルになります。
214     この大きさの制限がないことによる問題を防ぐために、
215     このディレクティブを使って CGI のログファイルの
216     最大のファイルサイズを設定することができます。
217     ファイルがこの大きさを超えた場合は、それ以上は書き込まれません。</p>
218 </usage>
219 </directivesynopsis>
220
221 <directivesynopsis>
222 <name>ScriptLogBuffer</name>
223 <description>スクリプトログに記録される PUT や POST リクエストの内容の上限</description>
224 <syntax>ScriptLogBuffer <em>bytes</em></syntax>
225 <default>ScriptLogBuffer 1024</default>
226 <contextlist><context>server config</context>
227 <context>virtual host</context>
228 </contextlist>
229 <modulelist><module>mod_cgi</module><module>mod_cgid</module>
230 </modulelist>
231
232 <usage>
233     <p>大きな本体を受け取ったときにログファイルがすぐに大きくなりすぎる
234     問題を避けるために、ファイルにログ収集される PUT と POST
235     の本体の大きさは制限されています。デフォルトでは、1024
236     バイトまでがログ収集されますが、
237     このディレクティブはそれを変更することができます。 
238     </p>
239 </usage>
240 </directivesynopsis>
241
242 </modulesynopsis>