<-
Apache > HTTP サーバ > ドキュメンテーション > バージョン 2.2 > モジュール

Please note

This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

Apache モジュール mod_actions

翻訳済み言語:  de  |  en  |  ja  |  ko 

説明:メディアタイプやリクエストメソッドに応じて CGI スクリプトを実行する機能を提供
ステータス:Base
モジュール識別子:actions_module
ソースファイル:mod_actions.c

概要

このモジュールには二つのディレクティブがあります。Action ディレクティブは特定の MIME タイプ のファイルをリクエストされた場合に CGI スクリプトが実行されるようにします。Script ディレクティブはリクエストで特定のメソッドが使用されたときに CGI スクリプトが実行されるようにします。 これはファイルを処理するスクリプトの実行をずっと簡単にします。

ディレクティブ

参照

top

Action ディレクティブ

説明:特定のハンドラやコンテントタイプに対して CGI を実行するように 設定
構文:Action action-type cgi-script [virtual]
コンテキスト:サーバ設定ファイル, バーチャルホスト, ディレクトリ, .htaccess
上書き:FileInfo
ステータス:Base
モジュール:mod_actions
互換性:virtual 修飾子とハンドラ渡しは Apache 2.1 で導入されました

このディレクティブは action-type がリクエストされたときに cgi-script が実行されるという動作を追加します。cgi-scriptScriptAliasAddHandler によって CGI スクリプトに設定されたリソースへの URL-path です。 Action-type には handlerMIME コンテントタイプを指定できます。リクエストされたドキュメントの URL とファイルのパスは標準 CGI 環境変数 PATH_INFOPATH_TRANSLATED を使って伝えられます。 特定のリクエストに対して使用されるハンドラへは、 REDIRECT_HANDLER 変数を使って渡せます。

# Requests for files of a particular MIME content type:
Action image/gif /cgi-bin/images.cgi

# Files of a particular file extension
AddHandler my-file-type .xyz
Action my-file-type /cgi-bin/program.cgi

最初の例では、MIME コンテントタイプが image/gif のファイルへのリクエストは、指定したスクリプト /cgi-bin/images.cgi で処理されます。

2 番目の例では、拡張子が .xyz のファイルへのリクエストは、指定したスクリプト /cgi-bin/program.cgi で処理されます。

オプションの virtual 修飾子を使用すると、 リクエストされたファイルが実際に存在するかどうかを検査しないようにできます。 これは例えば、Action ディレクティブをバーチャルな Location に使用したい、といった場合に便利です。

<Location /news>
SetHandler news-handler
Action news-handler /cgi-bin/news.cgi virtual
</Location>

参照

top

Script ディレクティブ

説明:特定のリクエストメソッドに対して CGI スクリプトを 実行するように設定
構文:Script method cgi-script
コンテキスト:サーバ設定ファイル, バーチャルホスト, ディレクトリ
ステータス:Base
モジュール:mod_actions

このディレクティブは method というメソッドを使ってリクエストが行なわれたときに cgi-script を実行するという動作を追加します。 cgi-scriptScriptAliasAddHandler によって CGI スクリプトに設定されたリソースへの URL-path です。 リクエストされたドキュメントの URL とファイルのパスは標準 CGI 環境変数 PATH_INFOPATH_TRANSLATED を使って伝えられます。

任意のメソッド名を使用することができます。 メソッド名は大文字小文字を区別します。ですから、 Script PUTScript put はまったく違った効果になります。

Script コマンドはデフォルトの動作を 追加するだけであることに 注意してください。もし CGI スクリプトが呼ばれたり、リクエストされた メソッドを内部で扱うことのできる他のリソースがあれば、それが行なわれます。 GET メソッドの Script は問合せ 引数がある場合にのみ (たとえば、foo.html?hi) 呼ばれるということにも注意してください。 そうでない場合は、リクエストは通常通り処理されます。

# For <ISINDEX>-style searching
Script GET /cgi-bin/search

# A CGI PUT handler
Script PUT /~bob/put.cgi

翻訳済み言語:  de  |  en  |  ja  |  ko 

top

コメント

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.