Installing mod_jk on Apache.
Software
Software used in this article:
- CentOS 6.9
- Apache 2.2.15
- Tomcat Connectors 1.2.42
Installation
# yum install httpd-devel apr apr-devel apr-util apr-util-devel gcc make libtool autoconf
Get the latest source tarball:
# wget http://www.eu.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz # wget http://www.eu.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz.sha1
Check the integrity of the file:
# sha1sum -c tomcat-connectors-1.2.42-src.tar.gz.sha1 tomcat-connectors-1.2.42-src.tar.gz: OK
Extract the archive:
# tar xf tomcat-connectors-1.2.42-src.tar.gz # cd tomcat-connectors-1.2.42-src/native/
Get the path for apxs:
# which apxs /usr/sbin/apxs
Configure, compile and install:
# ./configure --with-apxs=/usr/sbin/apxs # make # libtool --finish /usr/lib64/httpd/modules # make install
Configuration
Open the file /etc/httpd/conf/workers.properties
and add the following to reflect your application details:
worker.list=app1,app2 worker.app1.type=ajp13 worker.app1.host=app1.example.com worker.app1.port=8201 worker.app1.socket_timeout=10 worker.app2.type=ajp13 worker.app2.host=app2.example.com worker.app2.port=8201 worker.app1.socket_timeout=10
Open the file /etc/httpd/conf/httpd.conf
and add the following:
LoadModule jk_module modules/mod_jk.so JkWorkersFile "/etc/httpd/conf/workers.properties" JkLogFile "/var/log/mod_jk.log" JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat "%w %V %T"
Restart Apache. Check the log file mod_jk.log
for any issues:
[Sun Dec 03 10:08:57 2017] [7005:140288381306848] [info] init_jk::mod_jk.c (3595): mod_jk/1.2.42 initialized
Related Articles
Configure IIS 8 and Tomcat Connector ISAPI Filter on Windows Server 2012
References
http://www.diegoacuna.me/installing-mod_jk-on-apache-httpd-in-centos-6-x7-x/
Thank you for this useful cheatsheet. I’m not compiling mod_jk everyday so… this is a nice notes page.
You’re welcome!
Also thank you for the Cheat Sheet, compiling from source to create an in-house RPM, you really helped make the first part easy! :)
Bazinga! Thanks..
Thanks a lot – it still works.
OS: Red Hat Enterprise Linux 8.5 (4.18.0-348.20.1.el8_5.ppc64le)
SRC: tomcat-connectors-1.2.48-src.tar.gz
Superb, thanks for letting me know.