實戰apache+tomcat+mod_jk整合(轉)

post0發表於2007-08-09
實戰apache+tomcat+mod_jk整合(轉)[@more@]

在做本實驗之前你應該安裝好了apache,j2sdk,tomcat。有問題的可以參看我的前一篇文章。這裡就著重介紹mod_jk.

下載jakarta-tomcat-connectors-jk-1.2.4-src.tar.gz

cd /www

tar -xzf jakarta-tomcat-connectors-jk-1.2.4-src.tar.gz

mv jakarta-tomcat-connectors-jk-1.2.4 mod_jk

cd /www/mod_jk/jk/native

./buildconf

./configure --with-apxs=/www/http2/bin/apxs

make

cp apache-2.0/mod_jk.so /www/http2/modules/

準備兩個重要的配置檔案

修改httpd.conf,告訴伺服器裝載mod_jk模組。並配置使之轉發特定的請求給tomcat處理

#-------------------mod_jk-------------------

LoadModule jk_module libexec/mod_jk.so

# Declare the module for

#AddModule mod_jk.c

# Where to find workers.properties

JkWorkersFile /www/http2/conf/workers.properties

# Where to put jk logs

JkLogFile /www/http2/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 /examples/servlet/* worker1

# Send JSPs for context /examples to worker named worker1

JkMount /examples/* worker1

新建檔案/www/http2/conf/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

ok現在就可以測試了

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8225414/viewspace-937901/,如需轉載,請註明出處,否則將追究法律責任。

相關文章