Apache 2.2系ならmod_proxy_ajpモジュールを使う方が王道だろう。
JK2 は開発停止になっているので、JK ( mod_jk ) を使って Apache2 と Jakarta Tomcat を連携させる。プラットフォームはとりあえず Microsoft Windows XP Professional だが他のプラットフォームでも基本的には同じはず。
環境は次の通り。
手順は次のような感じ。
httpd.conf では、Include ディレクティブを使って mod_jk.conf を include するようにし、mod_jk.conf に mod_jk 関連の設定を書くことにした。内容は次のような感じ。
# Load mod_jk module
LoadModule jk_module "C:\Program Files\Apache Group\Apache2\modules\mod_jk.so"
# Declare the module for <IfModule directive> (remove this line on Apache 2.0.x)
#AddModule mod_jk.c
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile "C:/Program Files/Apache Group/Apache2/logs/mod_jk.log"
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context /examples to worker named worker1
JkMount /servlets-examples/servlet/* worker1
# Send JSPs for context /examples to worker named worker1
JkMount /jsp-examples/*.jsp worker1
workers.properties は次のようにした。とりあえずは、worker1 だけを使うようにした。
worker.list=worker1
# Define a worker using ajp13
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
Tomcat の server.xml はこの部分。
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
まあ、
Jakarta Tomcat Connector HowTo Documentation に詳細に書かれているのでそっちを読んだ方が良いかもしれず。