|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This document explains how to connect Tomcat to the popular open source web server, Apache. There is actually two version of Apache, 1.3 and 2.0 and both can be used with mod_jk, the Tomcat redirector module. この文書はTomcatを有名なオープンソースの Web サーバApacheに接続する方 法を説明します。 現在、Apacheには二つのバージョンがあります。 1.3と2.0の両方で、Tomcatリダイレクタモジュールのmod_jkを使用することができます。 It is recommanded that you also read the Workers HowTo document to learn how to setup the working entities between your WebServer and Tomcat Engines. Web サーバとTomcatエンジンの設定項目をどうやって設定するかを知るには、 ワーカの手引き もあわせて読むことをおすすめし ます。 This document was originally part of Tomcat: A Minimalistic User's Guide written by Gal Shachor, but has been split off for organizational reasons. この文書はGal Shachorによって書かれた Tomcat-簡易ユーザーガイド の一部でしたが、文書構成の変更により、分離されました。
${tomcat_home} is the root directory of tomcat. Your Tomcat installation should have the following subdirectories:
${tomcat_home} はTomcatのルートディレクトリとします。 Tomcatをインストールすると以下のディレクトリができます。
In all the examples in this document ${tomcat_home} will be /var/tomcat3 . A worker is defined to be a tomcat process that accepts work from the Apache server. この文書中のすべての例では ${tomcat_home} を /var/tomcat3 とします。 ワーカ は TomcatのプロセスがApacheから受け付けられるよう定義されていることとします。
The mod_jk module was developed and tested on:
mod_jkモジュールは下記の環境で開発され、テストされています。
The redirector uses ajp12 and ajp13 to send requests to the Tomcat containers. There is also an option to use Tomcat in process, more about the in-process mode can be found in the in process howto. リダイレクタは ajp12 と ajp13 を使って、 Tomcatコンテナにリクエストを送ります。 また、Tomcatをin-processで使うこともできます。 in-processモードについてはin process howtoを参照してください。
The ajp12 protocol is only available in Tomcat 3.2.x and 3.3.x. ajp12プロトコルは Tomcat 3.2.x と 3.3.xでのみ使用可能です。 The ajp12 has been deprecated with Tomcat 3.3.x and you should use instead ajp13 which is the only ajp protocol known by Tomcat 4.0.x, 4.1.x and 5. ajp12 は Tomcat 3.3.xでは 推奨されません 。 代わりに ajp13 を使ってください。 これは唯一、Tomcat 4.0.x, 4.1.x と 5 で扱えるajpプロトコルです。 Of course Tomcat 3.2.x and 3.3.x also support ajp13 protocol. もちろんTomcat 3.2.x と 3.3.x は ajp13 プロトコルをサポートしています。 Others servlet engines such as jetty have support for ajp13 protocol jetty のような他のServletエンジンでも ajp13 プロトコルはサ ポートしています。
In a nutshell a web server is waiting for client HTTP requests. When these requests arrive the server does whatever is needed to serve the requests by providing the necessary content. 簡単に説明すれば、WebサーバはクライアントのHTTPリクエスト常に待って います。 リクエストが届いたときには、サーバはあらかじめ必要なコンテンツを用意しておくことで、リクエストに必要な処理を行います。 Adding a servlet container may somewhat change this behavior. Now the web server needs also to perform the following: Servletコンテナを追加すると、この動作が少し変わります。 つまり、Web サーバは以下の処理を実行する必要があります。
The adapter on the other hand needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests. これに対して、アダプタは、これから処理するリクエストがリクエストURLのどのパターンを元にしていて、どこにリクエストを向けたらよいのかを知っておく必要があります。 Things are even more complex when the user wants to set a configuration that uses virtual hosts, or when they want multiple developers to work on the same web server but on different servlet container JVMs. We will cover these two cases in the advanced sections. ユーザが、バーチャルホストを使用するように設定したいと思っていたり、 複数の開発者に同じWeb サーバで異なるServletコンテナのJVMを動作させるようにしたいと思っている時には、さらに問題は複雑になります。 この二つの場合については、後から説明します。
mod_jk can be obtained in two formats - binary and source. Depending on the platform you are running your web server on, a binary version of mod_jk may be available. mod_jkは、2種類のフォーマット - バイナリとソース - で入手することができます。 Webサーバを動作させているプラットフォームによっては、mod_jkのバイナリ版が利用可能です。 It is recommended to use the binary version if one is available. If the binary is not available, follow the instructions for building mod_jk from source. バイナリ版が利用可能な場合には、それを使用することを勧めます。 バイナリが利用可能でない場合には、mod_jkをソースからビルドするために以下の指示に従ってください。 The binaries for mod_jk are now available, for several platforms, in a separate area as the Tomcat Binary Release. The binaries are located in subdirectories by platform. いくつかのプラットフォーム用のmod_jkのバイナリが、Tomcatのバイナリリリースとしてそれぞれ別の場所にあります。 これらのバイナリは、プラットフォームごとのサブディレクトリの中にあります。 For some platforms, such as Windows, this is the typical way of obtaining mod_jk since most Windows systems do not have C compilers. Windowsのようないくつかのプラットフォームに対しては、大部分のWindowsシステムはCコンパイラを持たないことから、これがmod_jkを入手する代表的な方法です。 For others, the binary distribution of mod_jk offers simpler installation. 他のプラットフォームに対しても、mod_jkのバイナリ配布はインストールをより簡単にします。 For example JK 1.2.1 can be found here and contains the following: たとえば、 JK 1.2.1 は以下のようなものを含んでいます
If you don't see your Operating System here, the doc may be outdated so just go here and check if one of the directory didn't cover your os もし、あなたの使っているオペレーティングシステムが見つからなければ、 この文書は古くなっているということですので、 ここ に行って、あるかどうか確かめてみてください。
mod_jk requires two entities:
mod_jk は2つのエンティティを必要とします。
Also as with other Apache modules, mod_jk should be first installed on the modules directory of your Apache webserver, ie : /usr/lib/apache and you should update your httpd.conf file. 他のApacheモジュールと同様に、mod_jkは、まずApache Web サーバの モジュールディレクトリ、例えば /usr/lib/apache、にインストールして、 httpd.conf ファイルを更新します。
If you've previously configured Apache to use mod_jserv , remove any ApJServMount directives from your httpd.conf. すでに mod_jserv を使用するようにApacheを設定している場合には、httpd.confからすべての ApJServMount 宣言子を削除してください。 If you're including tomcat-apache.conf or tomcat.conf , you'll want to remove them as well - they are specific to mod_jserv . tomcat-apache.conf や tomcat.conf をインクルードしている場合には、それらのファイルはmod_jserv固有なので、同様に削除します。 The mod_jserv configuration directives are not compatible with mod_jk ! mod_jserv設定指示子は、mod_jkとは互換ではありません!
The simplest way to configure Apache to use mod_jk is to turn on the Apache auto-configure setting in Tomcat and put the following include directive at the end of your Apache httpd.conf file (make sure you replace TOMCAT_HOME with the correct path for your Tomcat installation: mod_jkを使用するようにApacheを設定する最も簡単な方法は、TomcatのApacheの自動設定設定を有効にして、次のinclude指示子をApacheのhttpd.confファイルの最後に記入することです(以下のTOMCAT_HOMEをあなたがTomcatをインストールした正しい場所に置換したことを確かめてください)。
This will tell Apache to use directives in the mod_jk.conf-auto file in the Apache configuration. This file is created by enabling the Apache auto-configuration as described in the Tomcat documentation. これは、Apacheの設定ファイル中で、 Apacheにmod_jk.conf-autoファイル中の指示子を使用することを指示します。 このファイルは、Tomcatの文書中で述べられているように、 Apacheの自動設定を有効にすることによって作成されます。
You should use custom configuration when : 以下のような場合、カスタム設定を行います。
Here is a simple configuration: 以下は簡単な設定です。
We'll discuss here the mod_jk directives and details behind them ここでは、mod_jkの指示子と、背景にある詳細を論じます。
JkWorkersFile specify the location where mod_jk will find the workers definitions.
JkWorkersFile はmod_jkがワーカの定義ファイルを探す場所を指示します。
JkLogFile specify the location where mod_jk is going to place its log file.
JkLogFile はmod_jkにログファイルの記録場所を指示します。
JkLogLevel set the log level between : JkLogLevel 以下の範囲でログレベルを設定します。
info should be your default selection for normal operations.
info は通常運用するとき、デフォルトの選択になります。
JkLogStampFormat will configure the date/time format found on mod_jk logfile. Using the strftime() format string it's set by default to "[%a %b %d %H:%M:%S %Y]" JkLogStampFormat は、mod_jkのログファイルに記録される日付/時刻フォーマットを設定します。 デフォルトは、strftime()フォーマット文字列を使用して、 "[%a %b %d %H:%M:%S %Y] " に設定されます。
JkRequestLogFormat will configure the format of mod_jk individual request logging. Request logging is configured and enabled on a per virtual host basis. To enable request logging for a virtual host just add a JkRequestLogFormat config. The syntax of the format string is similiar to the Apache LogFormat command, here is a list of the available request log format options: JkRequestLogFormat はmod_jkで独立したリクエストログの書式を設定します。 リクエストログの記録はバーチャルホストごとに設定され、有効になります。 バーチャルホストのリクエストログの記録を有効にするには、 JkRequestLogFormatの設定を追加するだけです。 記録書式の文法は、ApacheのLogFormatコマンドと同一です。 利用可能なリクエストログの書式のオプションは以下に挙げるとおりです。
The directive JkOptions allow you to set many forwarding options which will enable (+)
or disable (-) following option.
JkOptions 指示子では
いくつもの転送オプションを有効(+)か無効(-)か
以下のようにセットできます。
JkOptions ForwardKeySize , you ask mod_jk, when using ajp13, to forward also the SSL Key Size as required by Servlet API 2.3. This flag shouldn't be set when servlet engine is Tomcat 3.2.x (on by default).
JkOptions の ForwardKeySize はajp13を使っているとき、mod_jkに Servlet API 2.3で要求されているSSLキーサイズを転送するよう設定します。 このフラグはTomcat 3.2.xでは(デフォルト状態では)設定するべきではありません。
JkOptions ForwardURICompat , you told mod_jk to send the URI to Tomcat normally, which is less spec compliant but mod_rewrite compatible, use it for compatibility with Tomcat 3.2.x engines (on by default).
JkOptions の ForwardURICompat は mod_jkに URI を普通に Tomcat に送るよう設定します。 これは仕様を満たしていませんが、mod_rewriteに互換があります。 Tomcat 3.2.xエンジン(デフォルト状態で)の互換性を持たすために使用します。
JkOptions ForwardURICompatUnparsed , the forwarded URI is unparsed, it's spec compliant but broke mod_rewrite.
JkOptions の ForwardURICompatUnparsed は転送されたURIを解釈しません。 これは仕様にしたがっていますが、mod_rewrite は動作しません。
JkOptions ForwardURIEscaped , the forwarded URI is escaped and Tomcat (since 3.3 rc2) will do the decoding part.
JkOptions の ForwardURIEscaped は転送されたURIをエスケープします。 Tomcat (3.3 rc2以降) はデコード処理を行います。
JkOptions
ForwardDirectories
is used in conjunction with
DirectoryIndex
directive of Apache web server. As such mod_dir should be available to Apache,
statically or dynamically (DSO)
JkOptions の
ForwardDirectories
はApache Web サーバの
DirectoryIndex
指示子と関連して使われます。
静的か、動的(DSO)かいずれの形で、Apacheのmod_dir が有効になっている必要が
あります。
When DirectoryIndex is configured, Apache will create sub-requests for each of the local-url's specified in the directive, to determine if there is a local file that matches (this is done by stat-ing the file). DirectoryIndex が設定されていた場合、 Apacheは 一致するローカルファイルが存在するかどうか決定するために、 この指示子で指定されたローカルURLのそれぞれに対する副問い合わせ を生成します。 (これらはファイルのstatを取ることで実行されます。) If ForwardDirectories is set to false (default) and Apache doesn't find any files that match, Apache will serve the content of the directory (if directive Options specifies Indexes for that directory) or a 403 Forbidden response (if directive Options doesn't specify Indexes for that directory). ForwardDirectories がfalse (デフォルト)に設定されていた場合で、 Apacheが一致するファイルを見つけられなかった場合、 Apacheはディレクトリの一覧を提供します (指示子のオプションでそのディレクトリに対してIndexesが指定されていた場合)。 または、403 Forbidden を応答します (指示子のオプションでそのディレクトリに対してIndexesが指定されていなかった場合)。 If ForwardDirectories is set to true and Apache doesn't find any files that match, the request will be forwarded to Tomcat for resolution. This is used in cases when Apache cannot see the index files on the file system for various reasons: Tomcat is running on a different machine, the JSP file has been precompiled etc. ForwarDirectories が true に設定されていた場合、 Apacheは一致するファイルを探しません。 リクエストは解決されるためにTomcatに転送されます。 これは、 いくつかの理由で Apacheがインデクスファイルを見つけられない場合、 たとえばTomcatが違うマシンで動いていた場合や、 JSPファイルがプリコンパイルされていた場合などに使われます。 Note that locally visible files will take precedence over the ones visible only to Tomcat (i.e. if Apache can see the file, that's the one that's going to get served). This is important if there is more then one type of file that Tomcat normally serves - for instance Velocity pages and JSP pages.
ローカル的に見られるファイルはTomcatからのみ見られるものより優先されること を注意してください。 (たとえば、Apacheがファイルを見つけられるとき、それが提供されます。) このことはVelocityやJSPページのように、 Tomcatが通常提供するファイル形式以上のものが存在する時に重要になります。
The directive JkEnvVar allow you to forward an environment vars from Apache server to Tomcat engine.
JkEnvVar 指示子は ApacheからTomcatへ環境変数を転送することを許可します。
If you have created a custom or local version of mod_jk.conf-local as noted above, you can change settings such as the workers or URL prefix. もしあなたが上記のようにmod_jk.conf-localのカスタマイズしたまたはローカルのバージョンを作成するならば、あなたはそのワーカまたはURLのプリフィックスのように設定を変更することができます。 JkMount directive assign specific URLs to Tomcat. In general the structure of a JkMount directive is: JkMount 指示子はTomcatにURLを割り当てます。 一般的な、JkMount指示子の構成を、以下に示します。
You can use the JkMount directive at the top level or inside <VirtualHost> sections of your httpd.conf file. トップレベルか、あなたのhttpd.confファイルの<VirtualHost>セクションの中で、JkMount指示子を使用することができます。
If the Tomcat Host appBase (webapps) directory is accessible by the Apache web server, Apache can be configured to serve web application context directory static files instead of passing the request to Tomcat. TomcatのホストのappBase (webapps)ディレクトリがApache Web サーバでアクセスできるようになっているとき、 Apacheは Web アプリケーションコンテキストディレクトリの静的なファイルを Tomcatにリクエストする代わりに、提供できるように設定できます。 Caution: If Apache is configured to serve static pages for a web application it bypasses any security contraints you may have configured in your web application web.xml config file. 注意: もしApacheが Web アプリケーションの静的なページを提供するよう設定されていた場合、 Web アプリケーションの設定ファイルweb.xmlで設定されている、 セキュリティ制限が迂回されます。 Use Apache's Alias directive to map a single web application context directory into Apache's document space for a VirtualHost: Apacheの Alias 指示子を、 単一の Web アプリケーションコンテキストディレクトリを ApacheのVirtuelHostのドキュメント空間に割り当てるために使ってください。
Use the mod_jk JkAutoAlias directive to map all web application context directories into Apache's document space. mod_jk の JkAutoAlias 指示子は 全ての Web アプリケーションコンテキストディレクトリを Apacheのドキュメント空間に割り当てるために使ってください。 Attempts to access the WEB-INF or META-INF directories within a web application context or a Web Archive *.war within the Tomcat Host appBase (webapps) directory will fail with an HTTP 403, Access Forbidden Web アプリケーションコンテキスト、または TomcatホストのappBase (webapps)ディレクトリの Web アーカイブ *.war の中のWEB-INFやMETA-INFにアクセスすることを試みた場合、 HTTP 403, Access Forbiddenとなって失敗します。
The mod_jk build use the widely used configure system. mod_jkのビルドは広く使われているconfigureシステムを使用しています。
In case you get source from CVS, ie without an existing configure script, you should have autoconf for configuration and installation. ソースをCVSから取得する場合、 たとえば今あるconfigureスクリプトを使わないとき、 設定とインストールにautoconf使う必要があります。 To create jakarta-tomcat-connectors's autoconf script, you will need libtool 1.3.3 or higher, and autoconf 2.13 or newer. jakarta-tomcat-connectorsの autoconf スクリプトを生成するには、 libtool 1.3.3 以上、autoconf 2.13 より新しいもの使う必要があります。 Those tools will not be required if you are just using a package downloaded from apache.org, they are only required for developers. これらのツールは、 apache.orgからパッケージをダウンロードして使うだけの場合は 必要ではありません。開発者にのみ必要です。
To create the configure script just type :
Here's how to use configure to prepare mod_jk for building, just type: ./configure [autoconf arguments] [jakarta-tomcat-connectors arguments] mod_jkの構築の準備をするため、configureを使うには、以下のように入力します。 ./configure [autoconf 引数] [jakarta-tomcat-connectors引数] You could set CFLAGS and LDFLAGS to add some platform specifics: いくつかのプラットフォーム固有の部分を追加するために、 CFLAGS と LDFLAGS をセットできます。
If you want to build mod_jk for Apache 1.3 and 2.0, you should
The module was developed using Visual C++ version 6.0, so having this environment is a prerequisite if you want to perform a custom build. モジュールはVisual C++バージョン 6.0で開発されています。 カスタムビルドを行いたいのであれば、この環境が必要です。 The steps that you need to take are: 手順は以下の通りです。
An example on how to build mod_jk for Apache 1.3: Apache 1.3用にmod_jkをビルドする例です。
An example on how to build mod_jk for Apache 2.0: Apache 2.0用にmod_jkをビルドする例です。
If msdev is not in your path, enter the full path to msdev.exe. Also, ApacheCore.lib is expected to exist in the ${APACHEX_HOME}\src\CoreD and ${APACHEX_HOME}\src\CoreR directories before linking will succeed. You will need to build enough of the Apache source to create these libraries. This will build both release and debug versions of the redirector plug-in (mod_jk). An alternative will be to open mod_jk.dsp in msdev and build it using the build menu. msdevがパスの中にない場合、msdev.exeのフルパスを入力してください。 また、ApacheCore.libが ${APACHEEX_HOME}\src\CoreD の中に存在して、 ${APACHEX_HOME}\src\CoreR ディレクトリの前にリンクされる必要があります。 これらのライブラリを生成するためには、Apacheのソースをビルドする必要があります。 この方法でリダイレクタプラグイン(mod_jk)のリリース版とデバッグ版の両方を作成できます。 他にmsdevの mod_jk.dsp をオープンして、ビルドメニューを使って作成する方法があります。
Since OS400 V4R5, iSeries (AS/400) has used Apache 2.0 as their primary web server, replacing the old IBM webserver. It's now possible to build mod_jk on iSeries thanks to the help of the IBM Rochester Labs which has provided information and patches to adapt mod_jk to OS400. OS400 V4R5, iSeries (AS/400) は旧IBM Web サーバの置き換えで、 Apache 2.0をプライマリの Web サーバとして使用しています。 iSeriesでmod_jkをビルドすることが可能になりました。 IBMロチェスター研究所がmod_jkをOS400に適用させるための情報とパッチを提供してくれたおかげです。 You should have at least Apache 2.0.39, a C Compiler and IFS. Apache 2.0.39 is provided with the most recent set of PTFs for the iSeries Apache server, which can be found at http://www.ibm.com/servers/eserver/iseries/software/http/ Apache 2.0.39以上とCコンパイラとIFSが必要です。 Apache 2.0.39 はiSeries Apacheサーバのための最新のPTFセットを提供されています。 それらは http://www.ibm.com/servers/eserver/iseries/software/http/ で見つけることができます。 To configure mod_jk on iSeries use the CL source provided with the mod_jk source. iSeries のmod_jkを設定するにはmod_jkのソースが提供するCLソースを使います。
In the edited file, specify that only jk_module should be exported :
You could start to build all the modules of mod_jk :
Next, you should restart your Apache 2.0 server and enjoy this piece of OpenSource on iSeries. 次にApache 2.0サーバを再起動して、 iSeries上でのオープンソースのひとかけらを満喫してください。
mod_jk allows to install mod_jk in the Apache source tree to get a statically linked mod_jk. Having mod_jk in the httpd executable brings some performance improvements. The configure option --with-apache prepare mod_jk to install it in the Apache source tree. The option --with-apache works both for Apache-1.3 and Apache-2.0. The examples below show how to get mod_jk in the httpd process. mod_jk は静的にリンクされたmod_jkをつくるため、 mod_jkをApacheソースツリーのなかにインストールすることができます。 mod_jkをhttpd実行ファイルの中に入れることはいくつかのパフォーマンス改善をもたらします。 configureのオプション --with-apache はmod_jkをApacheソースツリーに インストールするように準備します。 --with-apache のオプションはApache-1.3と Apache-2.0で動作します。 以下の例は、httpdプロセスにmod_jkを組み込む方法です。
The enable-jk=share and enable-jk=static are not supported. --with-mod_jk only allow static linking of mod_jk. enable-jk=share と enable-jk=static はサポートしていません。 --with-mod_jk のみがmod_jkの静的リンクを許可します。
The --enable-shared=jk is also working and builds a dso file. --enable-shared=jk も有効で、dsoファイルを構築します。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[訳注: これは新舘邦貴が翻訳しました。日本語訳に対するコメントがあれば、こちらに送って下さい。(角瀬和博氏および風間一洋氏の翻訳を参考にしました。)]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||