Confluence 3.5 のサポートは終了しています。
ドキュメントの最新バージョンを確認してください。
The content on this page relates to platforms which are not supported for Confluence. Consequently, Atlassian can not guarantee providing any support for the steps described on this page. Please be aware that this material is provided for your information only and that you use it at your own risk.
はじめに
Apache web サーバーは、高負荷環境のパフォーマンスを改善するため、アプリケーション サーバーのフロントでよく使用されます。mod_jk を使用すると、AJP と呼ばれるプロトコルを介して、リクエストをアプリケーションに転送することができます。この設定は、Apache での mod_jk の有効化、アプリケーション サーバーでの AJP コネクタの設定、または Apache への mod_jk を介したアプリケーション サーバーへの特定のパスの転送の指示に関係します。
Mod_jk is sometimes preferred to mod_proxy because AJP is a binary protocol, and because some site administrators are more familiar with it than with mod_proxy..
このドキュメントのスコープは、Tomcat 5.x の AJP コネクタの設定に限定されています。他のアプリケーション サーバーも AJP コネクタをサポートしている場合があるため、設定する方法の手順に関するアプリケーション サーバーのドキュメントを参照してください。
以下の設定は、Confluence インスタンスが、アプリケーション サーバーと web サーバーで同じパスが適用されていることを前提としています。例:
外部からアクセス可能な(web サーバーの) URL |
|
---|---|
アプリケーション サーバーの URL (HTTP) |
アプリケーション サーバーのAJP 接続は app-server.internal.example.com:8009 に設定されています。
Apache での mod_jk の設定
Apache の標準のディストリビューションには mod_jk が含まれません。JK ホームページからこれをダウンロードし、Apache モジュール ディレクトリに mod_jk.so ファイルを配置する必要があります。
次に、以下を httpd.conf に直接追加するか、他のファイルからインクルードします。
# Put this after the other LoadModule directives LoadModule jk_module modules/mod_jk.so # Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts) JkWorkersFile conf/workers.properties JkLogFile logs/mod_jk.log JkLogLevel info JkMount /confluence worker1 JkMount /confluence/* worker1
workers.properties の設定
「workers.properties」というファイルを新しく作成し、Apache の conf ディレクトリに配置します(workers.properties は上記の設定ファイルの1つです)。
worker.list=worker1 worker.worker1.host=app-server.internal.example.com worker.worker1.port=8009 worker.worker1.type=ajp13
Tomcat 5.x の設定
Tomcat 5 において、デフォルトではポート 8009 でAJP コネクタが有効になっています。比較のため、以下には Tomcat の server.xml を最小限表示しています。関連する行は、ポート 8009 の Connector の部分です。server.xml でこれがコメント化されていないことを確認します。
<Server port="8005" shutdown="SHUTDOWN"> <Service name="Catalina"> <!-- Define a HTTP/1.1 Connector on port 8080 --> <Connector port="8080" /> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" /> <Engine name="Catalina" defaultHost="localhost"> <Host name="localhost" appBase="webapps"> <Context path="/confluence" docBase="/opt/webapps/confluence-2.2/confluence"/> <Logger className="org.apache.catalina.logger.FileLogger"/> </Host> </Engine> </Service> </Server>
注意点:
- ポート 8009 の Connector が「AJP/1.3」のプロトコルを持っていること。これが重要です。
- Confluence アプリケーションの Context path が「/confluence」であること。これは web サーバーの Confluence にアクセスするのに使用されるパスと一致している必要があります。
- Tomcat 5.x の server.xml の外側のアプリケーション Contexts はそのままにしておくことをお勧めします。上記の例では、例として示すためだけに表示しています。
mod_jk コネクタのパフォーマンスの改善
高負荷環境におけるもっとも重要な設定は、Tomcat AJP コネクタが使用するプロセッサ スレッド数です。デフォルトでは、これは200になっていますが、Apache の maxThreads (デフォルトでは256)と一致するように増やす必要があります。
<Connector port="8009" minSpareThreads="5" maxThreads="256" protocol="AJP/1.3" />
AJP コネクタについての設定パラメータのすべては、Tomcat ドキュメントでカバーされています。
UTF-8 互換性の保証
ファイル名に非アスキー文字を含む添付ファイルをダウンロードする際に問題が発生した場合、以下を Apache の設定に追加します。
JkOptions +ForwardURICompatUnparsed
そして、AJP コネクタの設定の URIEncoding に UTF-8 を指定します。
<Connector port="8009" protocol="AJP/1.3" URIEncoding="UTF-8" />
これらの設定の詳細については、「Tomcat の URI エンコーディングの設定」を参照してください。
詳細情報
Tomcat JK web サイトには、workers.properties や Apache の設定の完全なドキュメントがあります。IIS で mod_jk を使用する方法についての情報もそこで見つけることができます。
代替手段
If you're not happy with mod_jk, or find it too difficult to configure, you can:
- use mod_proxy, which works with any application server, and together with mod_proxy_html allows complex URL rewriting to deal with different application paths on the web server and the application server.