Configuring Apache 2 and Tomcat 5.5 with mod_jk

A configuration nightmare simplified....

1 : Download the mod_jk.so from here .
2 : Rename the downloaded .so file to mod_jk.so and copy it to
/modules folder :
Usually on Windows :C:\Program Files\Apache Group\Apache\modules Linux :/usr/lib/apache/
3 : Open the httpd.conf from your /conf directory
and put the following lines just after the last 'LoadModule' entry.
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module "C:/Program Files/Apache
Group/Apache2/modules/mod_jk.so"
# Declare the module for (remove this line on Apache 2.x)
# AddModule mod_jk.c (Gotcha : Remove this is you have Apache 2.x)
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties
# next to httpd.conf)
JkWorkersFile "D:/Tomcat 5.5/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 "D:/Tomcat 5.5/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 everything for context /examples to worker named worker1 (ajp13)
JkMount /tomcat-docs/* worker1
Note : Change the paths according to your setup

Hack : Even in Windoze machines, we need to provide '/' for path separators
Never give patch like 'D:\Apache' it will never work. Always give path
as 'D:/Apache' in ALL the config files.

4 : Open workers.properties files from your /conf folder
and add the following lines :
# 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.reclycle_timeout=300
5 : Save all the files.
6 : Restart Apache and Tomcat.
7 : Go to Firefox and give the following URL : http://localhost/tomcat-docs/
8 : You should be able to see the correct page from this apache URL
--Some great information is found here, here, and here.

No comments: