Installing mod_webapp and using it with Apache 1.3 mod_webapp のインストールと Apache 1.3 での使用 -------------------------------------------------- Once you have successfully built the mod_webapp DSO as described in the README.txt file coming with the sources, installing the module is pretty easy. ソースコード一式の中にある README.txt の説明に従って、mod_webapp の DSO 用コンパイルが終っているのなら、モジュールのインストールはとても簡単です。 First of all, copy the resulting mod_webapp.so file you will find in this directory (or in the apache-1.3 directory if you're building from sources) into your Apache 1.3 "libexec" directory (that directory where all DSO modules for Apache reside). まず、コンパイルによりトップディレクトリ(あるいは、ソースからビルドした場合は apache-1.3 ディレクトリ)に作られた mod_webapp.so を Apache 1.3 の "libexec" (DSO でプラグインする Apache のモジュールを置く)ディレクトリにコピーします。 If you're using Apache 1.3 for Windows, your modules directory will be called "modules" (there's a "libexec directory, but it contains other stuff). Please take care when loading the module. For Windows your "LoadModule" directive looks like: Apache 1.3 を Windows で動かしている場合は、モジュールを置くのは "modules" という名前のディレクトリです("libexec" という名前のディレクトリもありますが、 別の用途に使われています)。モジュールをロードするときには十分に注意して ください。Windows 環境では "LoadModule" ディレクティブは次のようになります。: LoadModule webapp_module modules/mod_webapp.so Another note for Windows: copy also the "libapr.dll" file with the module, or your Apache 1.3 web server will refuse to start reporting that the WebApp module cannot be loaded. Windows でのもうひとつの注意点: "libapr.dll" もモジュールと共にコピーして ください。これを忘れると、 Apache 1.3 Web サーバは WebApp モジュールを ロード出来ないというエラーをレポートするばかりで起動しなくなります。 Once you have done that, edit your "httpd.conf" configuration file and add a few lines to load that module at startup (Windows users, read above, you have to "replace" libexec with "modules" - I'm paranoid, sorry): 以上の作業が終了したら、 コンフィギュレーションファイル "httpd.conf" に 数行追加して、起動時にモジュールをロードするようにします。(Windows ユーザは すでに触れたように、適宜、libexec を "modules" と "読み換えて" ください。 - わるいけれど、ヘンなんだ。) LoadModule webapp_module libexec/mod_webapp.so and AddModule mod_webapp.c NOTE: It was reported that sometimes Apache under windows doesn't like the AddModule line in the configuration file. Please, if you can't start your Apache service, try commenting out that line in your httpd.conf file. 注意: Windows 環境で Apache を動かしている場合、コンフィギュレーションに 追加する AddModule 行との相性が悪いらしくエラーが報告されることがあります。 Apache を起動できなかったら、httpd.conf ファイルのその行をコメントアウト して試してください。 Looking at the default "httpd.conf" file coming with Apache 1.3, I usually add the "LoadModule ..." line at the end of all pre-written and commented out "LoadModule" directives, and my "AddModule ..." directive at the end of all commented out "AddModule" directives. My "httpd.conf" file looks something like this: Apache 1.3 に付属しているディフォルトの "httpd.conf" を見てください。 あらかじめ書き込まれていて、コメントアウトされている "LoadModule" ディレクティブがいくつかありますが、通常、私はそれらの後に "LoadModule ..." を追加します。また、"AddModule ..." ディレクティブはコメントアウトされている "AddModule" ディレクティブの後に追加します。私の "httpd.conf" ファイルは 次のようになっています。: [...] #LoadModule unique_id_module libexec/mod_unique_id.so #LoadModule dav_module libexec/libdav.so #LoadModule ssl_module libexec/libssl.so LoadModule webapp_module libexec/mod_webapp.so [...] ClearModuleList [...] #AddModule mod_unique_id.c #AddModule mod_dav.c #AddModule mod_ssl.c AddModule mod_webapp.c [...] Once you've edited your "httpd.conf" in such fashion, it's better to check if everything still works within the Apache core. You can test your newly constructed configuration by issuing: このような方法で "httpd.conf" を編集し終ったら、修正分が Apache core の 動作に何も問題を与えていないことをチェックしておくといいでしょう。 次のようにすると新しくなったコンフィギュレーションをテストできます。 apachectl configtest The apachectl script comes with your Apache 1.3 distribution. It usually lies in /usr/local/apache/bin, but depending on _YOUR_ apache distribution, that might change. apachectl スクリプトは Apache 1.3 一式の中にあります。通常このスクリプトは /usr/local/apache/bin 以下にありますが、_あなた_ が Apache インストールした 際のディレクトリ指定に依存しますから違うこともあるでしょう。 Once you verified that "apachectl" reports "Syntax OK" (meaning that all modules have been successfully loaded and started), you can start adding your web application connections and context into the Apache configurations. Back to the "httpd.conf" file, you need to add something like: "apachectl" を実行した結果、"Syntax OK"(全てのモジュールが正しくロードされ 起動されたことを意味します) と返ってきて正しく設定できたことがわかったら、 次に、Web アプリケーションコネクタとコンテキストを対応させる設定を Apache のコンフィギュレーションに追加します。再び "httpd.conf" ですが、 たとえば次のような設定を追加しなければなりません。: WebAppConnection conn warp localhost:8008 WebAppDeploy examples conn /examples In this example, I'm instructing the WebApp connector to connect to the servlet container waiting for requests on the current "localhost" host and bound to port 8008 (note, this port is the one you specified in your "server.xml" file for the "org.apache.catalina.connector.warp.WarpConnector" connector, not your HTTP one). この例では、WebApp コネクタに "localhost" というホストで 8008番ポート(この ポート番号は server.xml の "org.apache.catalina.connector.warp.WarpConnector" コネクタの設定で指定されているものです。HTTP のポート番号ではありません。) でリクエストが来るのを待っているサーブレットコンテナに接続するように指示 しています。 A brief detailed description of the above-mentioned directives is: 上記ディレクティブの詳細を簡単にまとめると次のようになります。: WebAppConnection [connection name] [provider] [host:port] [connection name] A unique name for the connection to be created between Apache and Tomcat. Apache と Tomcat の間に生成されるコネクションにつけるユニークな 名前。 [provider] The name of the provider used to connect to the servlet container. Currently only the "warp" provider is available. サーブレットコンテナに接続するのに利用するプロバイダの名前。 現時点で利用できるのは "warp" プロバイダだけ。 [host:port] The host name and port number to which the WARP connection must attempt to connect. The port is the one you specified in your "server.xml" file for the "...WarpConnector" connector, not your HTTP one. WARP コネクションが接続を試みることになるホスト名とポート番号。 ポート番号は server.xml の "...WarpConnector" コネクタのところ で指定したものです。 HTTP のポート番号ではありません。 WebAppDeploy [application name] [connection name] [url path] [application name] The application name as present in your "webapps" directory in Tomcat. For example, if you want to deploy a WAR-based web application, your application name will look something like "myApplication.war". Tomcat の "webapps" ディレクトリにある Web アプリケーション名。 例えば、WAR 形式の Web アプリケーションを配備したい場合には アプリケーション名は "myApplication.war" のようになります。 [connection name] The name of a previously declared WebAppConnection directive. 既に宣言されている WebAppConnection ディレクティブの名前。 [url path] The URL path where this application will be deployed. この Web アプリケーションを配備する URL パス。 The "WebAppDeploy" directive is scoped around the current host, meaning that if you insert it into a "" tag, your application will be deployed only for that particular virtual host. To deploy the same application on several virtual hosts, you will have to declare it once inside each "" tag. This, in accordance with the Servlet specification, will create a new instance of the web-application per virtual host. "WebAppDeploy" ディレクティブはサーバが動いているホスト(名)に範囲が限られて いますが、"" タグの中で設定すると、Web アプリケーションは 特定のバーチャルホストに対してのみ配備されることになります。一つの Web アプリケーションを複数のいくつかのバーチャルホストに配備するには、 各 "" タグの中で一回ずつ宣言しなければなりません。つまり、 Servlet API の仕様どおりにバーチャルホストごとに新たに Web アプリケーションの インスタンスを生成します。 Another directive is available for the WebApp connector. The "WebAppInfo" directive will allow you to see the current status of all configured connections and deployed applications. To use it, simply add something like: WebApp コネクタでは上記以外にも利用可能なディレクティブがあります。 "WebAppInfo" ディレクティブは設定したコネクタと配備した Web アプリケーション 全ての現在のステータスを見えるようにしてくれるものです。使うには次のような 設定を追加するだけです。: WebAppInfo /webapp-info You can then access the information page hitting your web server for the following URL: 次の URL で目的の Web サーバ情報表示ページにアクセスできます。: http://server.name:port/webapp-info/ Have fun... 健闘を祈ります... Pier