If you want to run Tomcat from behind Apache as many people do then you need to find a method of sending requests from Apache to Tomcat. One of the popular mechanisms is to use “mod_jk”. The problem is that Apache or httpd does not generally come with mod_jk.
I had this problem when I upgraded to Apache 2.4 recently and could not find a binary mod_jk for Fedora 18. Actually I was running Apache HTTP server 2.4, Tomcat 6.0.35, Java 1.6.0_23 and Fedora 18. I spent a lot of time looking and started to find a few articles on building mod_jk. I came to the conclusion that if you run Apache and Tomcat on Linux then you can probably build it yourself.
You know what………. actually it’s pretty easy 😎
Resources
Build MOD_JK connector
http://www.openscope.net/2010/01/02/install-mod_jk/
Tomcat website
http://tomcat.apache.org/
Apache HTTP server website
http://projects.apache.org/projects/http_server.html
Tomcat mod_jk connector
http://tomcat.apache.org/download-connectors.cgi
Steps
1. | Download the Tomcat connector from the Tomcat mod_jk connector page. In my case I downloaded “tomcat-connectors-1.2.37-src.tar.gz” |
2. | Copy to a directory, in my case “/tmp/mod_jk” and run
tar -zxvf tomcat-connectors-1.2.37-src.tar.gz |
3. | After extracting the gzip file move to the new “native” directory. In my case
/tmp/mod_jk/tomcat-connectors-1.2.37-src/native |
4. | You need to find out where apsx is on your system. Often this comes with the “httpd-devel” RPM. You can check by finding httpd-devel in YumEx and looking for the packaged files. In my case it was at:
/usr/bin/apsx |
5. | From the same directory “native” run:
./configure --with-apxs=/usr/bin/apxs make make install |
You should find a copy of “mod_jk.so” with your other Apache modules which in my case was:
/usr/lib/httpd/modules