Tomcat’s Apache2 Connector

Installing the Tomcat connector

A tomcat

mod_jk

First off, we get the source code for the latest connector, mod_jk.

cd /usr/local/src   
wget http://mirror.intergrid.com.au/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz
gzip -d tomcat-connectors-1.2.42-src.tar.gz 
tar xvf tomcat-connectors-1.2.42-src.tar 

I wish I had saved a day by ignoring the “How To” on creating and adding a module to apache2…  https://httpd.apache.org/docs/2.4/developer/modguide.html

This is the way to go:  http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html              “Getting mod_jk linked statically with Apache”

As noted there, we do indeed need libtool 1.5.2, automake 1.10 and autoconf 2.59 or newer.

apt-get install automake
apt-get install autoconf
apt-get install libtool

And while there, for good measure or perhaps superstitional reasons, apt-get install httpd-devel

Also, for some forgotten and otherwise unknown reason, libtool was not in an expected path for me, so I created a link to it by doing this and kept going:

cd /usr/local/bin
ln -s /usr/local/src/httpd-2.4.25/srclib/apr/libtool libtool

Then all seemed to work:

cd /usr/local/src/tomcat-connectors-1.2.42-src/native
./configure --with-apache=/usr/local/src/httpd-2.4.25
make
make install   ( this “install” copies mod_jk files to the apache src tree in httpd-2.4.25 )

Installation instructions for my apache2 compile  is here: http://jamesharryburton.com/index.php/2017/03/23/apache2-latest-with-ssl/

Now we can compile apache2 with the included code for mod_jk.

cd /usr/src/httpd-2.4.25
make clean
./buildconf

./configure --enable-ssl                                             
            --with-ssl=/usr/local/src/openssl-1.0.2k      
            --enable-ssl-staticlib-deps                            
            --enable-mods-static=ssl                             
            --with-included-apr                                    
            --enable-mods=most                                  
     --with-mpm=prefork                ( needed for php to work )
            --with-mod_jk
make
make install

/usr/local/apache2/bin/httpd -l    Shows that mod_jk.c is in fact now compiled in.

As I left out where the log files need to be created ( the default goes in /usr/local ), important to edit the apche2 configuation file ( /usr/local/apche/conf/httpd.conf ) so others can find them, ie applications like awstats and system utilities like cron, which expect to find them under /var/log.

JdLogFile=/var/log/apache2
ErrorFile=/var/log/apache2/error.log
LogFile=/var/log/apache2/access.log    ( and any other specific logs for other domains )

© 2017, James Harry Burton. All rights reserved.