關於apache和tomcat的連接器

mod_jk2確實很爛。

幾天的mod_jk2的雲山霧罩之後,apache2+tomcat5用mod_jk.so輕鬆搞定。

儘管apache.org也稱不建議使用令人唾棄的mod_jk2.so了。但最新的tomcat中卻給出的mod_jk2.so的默認配置文件:workers2.properties。大家不要被它迷惑。

推薦大家不用理會該文件,依舊採用mod_jk.so的workers.properties。如果不想從頭手寫配置文件,可以從老的tomcat中找到。或者在官方網站http://jakarta.apache.org/tomcat/connectors-doc-archive/jk2/jk/quickhowto.html可以找到。

httpd.conf加入以下幾行:

# Load mod_jk module
# Update this path to match your modules location

LoadModule jk_module libexec/mod_jk.so

# Declare the module for <IfModule directive>

AddModule mod_jk.c

# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)

JkWorkersFile conf/workers.properties

# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)

JkLogFile /var/log/httpd/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 everything for context /examples to worker named worker1 (ajp13)

JkMount /examples/* worker1

workers.properties :

# Define 1 real worker using ajp13

worker.list=worker1

# Set properties for worker1 (ajp13)

worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300

發佈了42 篇原創文章 · 獲贊 5 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章