I have used Tomcat + Apache for a while - yet I have never had to do the installation myself. Recently I needed an R&D server for the Jira Services I'm developing; enter mod_jk installation. This post is for anyone that wants to install mod_jk - the right way - and avoid the nightmare documentation that currently exists.
# configure shared memory
file = /opt/tomcat5/logs/shm.file
size = 1048576
# configure tomcat worker
worker.list = mod_jk_worker
worker.mod_jk_worker.type = ajp13
worker.mod_jk_worker.host = localhost
worker.mod_jk_worker.port = 8009
# channel only used in Windows
worker.mod_jk_worker.channel = myTomcat
LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
JkWorkersFile /etc/apache2/conf/workers2.conf
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkRequestLogFormat "%w %V %T"
JkMount /jira mod_jk_worker
JkMount /jira/* mod_jk_worker
</IfModule>
Believe it or not this simple information is not properly documented - even though many referrers will point you to here and here. In fact Cory Foy's post - if you look closely - has him running mod_jk2 even after trying to move back to mod_jk.
Anyway, I hope this helps you.
Comments
Alternative Configuration using Gentoo default
mod_jk post
I'm going to modify it to point back here, because it seems like you have it right. Thanks for clearing it up! - Cory
in next-gen-web fashion...
mod_jk is masked
wrong dir
JkWorkersFile /etc/apache2/conf/workers2.conf
Anyway, I keep getting this error in /var/log/apache2/mod_jk.log
----
[Sat Nov 19 20:14:48 2005] [8196:52064] [debug] build_worker_map::jk_worker.c (236): creating worker mod_jk_worker [Sat Nov 19 20:14:48 2005] [8196:52064] [debug] wc_create_worker::jk_worker.c (141): about to create instance mod_jk_worker of ajp13 [Sat Nov 19 20:14:48 2005] [8196:52064] [debug] wc_create_worker::jk_worker.c (154): about to validate and init mod_jk_worker [Sat Nov 19 20:14:48 2005] [8196:52064] [debug] ajp_validate::jk_ajp_common.c (1794): worker mod_jk_worker contact is 'localhost:8009' [Sat Nov 19 20:14:48 2005] [8196:52064] [error] ajp_validate::jk_ajp_common.c (1803): can't resolve tomcat address localhost [Sat Nov 19 20:14:48 2005] [8196:52064] [error] ajp_validate::jk_ajp_common.c (1806): invalid host and port localhost 8009 [Sat Nov 19 20:14:48 2005] [8196:52064] [debug] ajp_destroy::jk_ajp_common.c (2000): up to 0 endpoints to close [Sat Nov 19 20:14:48 2005] [8196:52064] [error] wc_create_worker::jk_worker.c (158): validate failed for mod_jk_worker [Sat Nov 19 20:14:48 2005] [8196:52064] [error] build_worker_map::jk_worker.c (256): failed to create worker mod_jk_worker [Sat Nov 19 20:14:48 2005] [8196:52064] [debug] jk_cleanup_shmem::mod_jk.c (1736): Shmem cleanup ----
Saludos
Sas
ajp13 listening on 8009?
Apologies if you've already confirmed this - but I would verify that channel-socket services are on 8009. You can do this with netstat, crawling tomcat logs, etc.
...or tomcat admin site....or you could go straight to tomcat conf and make sure connector setting for 8009 is uncommented.
Rjae