I’ve done a few previous articles on Apache Tomcat (one for installing it on Linux and one for installing it on OS X), but I haven’t yet mentioned installing the JK Connector (mod_jk) in any environment. For those who are wondering what on earth I’m on about, mod_jk allows the Apache web server to serve your Tomcat web apps so they appear on port 80. There are a number of reasons why you might want to do this. Firstly, it provides a simple and secure way to get Tomcat to respond to requests on port 80 without having to have it run as root. Apache is more efficient at serving static pages so it can help increase the efficiency of your web app, and finally it allows you leverage all the power of Apache’s many features for your Java web app.

Technorati Tags: , , , , ,

As I write this there is no binary version available for Apache 1.3 on Mac OS X so unless you’re using OS X server (or are running Apache2 on your regular OS X install) you’ll have to compile the code yourself. First you’ll have to grab the source from the Apache server and expand it to a folder on your machine. Then you’ll have to open up a terminal, get a root shell (sudo bash) and then change into the folder native inside the folder you got when you expanded the tar.gz file. Here you have to configure the source to prepare to build it with the following command:

./configure --with-apxs=/usr/sbin/apxs

When that completes change into the folder apache-1.3 and actually compile the connector with:

cd apache-1.3
make -f Makefile.apxs

When the compile finishes you have to copy the library that was generated to the appropriate system folder and set the correct permissions on it:

cp mod_jk.so /usr/libexec/httpd/
chmod ugo+x /usr/libexec/httpd/mod_jk.so

At this point mod_jk is installed and all you have to do now is configure it and configure apache to use it. The first thing we need to do is to create the workers property file which is generally saved as /usr/local/tomcat/conf/worker.properties and should contain:




Note: depending on your configuration you may need to change workers.tomcat_home and workers.java_home.

Now we have to tell Apache to load mod_jk and what tomcat folders to map to what Apache URLs. We do this by editing the apache config file which can be found in /etc/httpd/httpd.conf. You need to add lines like the ones below after the AddModule statements. Don't add these lines just below the other LoadModule statements above the AddModule statements because that won't work.

LoadModule jk_module libexec/httpd/mod_jk.so

JkWorkersFile /usr/local/tomcat/conf/worker.properties
JkLogFile /private/var/log/httpd/mod_jk.log
JkLogLevel trace

JkMount /* myworker

Note: this config will map all the webapps in your Tomcat install to apache. I.e. if you have a web app at http://my.server.ie:8080/myWebApp/ then it will now be mapped to http://my.server.ie/myWebApp.

Now just restart Apache and cross your fingers!

apachectl restart


8 Responses to “Installing mod_jk for Apache 1.3 on Mac OS X 10.4 Tiger”

  1. Eliot Stock on May 9th, 2007 11:34 pm

    This was very helpful but I couldn’t get 1.2.22 to build at all. Before ./configure would run for me, I had to convert line endings from DOS to Unix in the following files:


    After that make gave me some errors.

    1.2.21 was ok though and seems to be working.

  2. zegabi on November 13th, 2007 3:22 am

    any comments for mac OS X 10.5?

  3. Bart B on November 13th, 2007 12:12 pm

    Hi Zegabi, I haven’t upgraded my servers to Leopard yet so I’m afraid I can’t be of much help.

    All I can say is that it should work but the version of Apache in Leopard is 2.2 so you’ll have to use the appropriate dir for that rather than for Apache 1.3.

    If you do give it a go please post back here with how you get on.



  4. Rodrigo Gonzales on November 18th, 2007 3:32 pm

    very helpful, thanks

  5. André van Toly on December 13th, 2007 4:19 pm

    I just figured it out for Mac OS X 10.5, with a little help from the blogsphere of course ;-) See my website http://www.toly.nl

  6. Installing mod_jk for Apache 2.2 on Mac OS X 10.5 Leopard : Bart Busschots on August 26th, 2009 2:49 pm

    [...] few years ago I did a similar tutorial for installing mod_jk on OS X 10.4 Tiger, but yesterday I discovered that those instructions do not work for Leopard. It took my quite a bit [...]

  7. Lawrie on January 25th, 2010 9:17 am

    Great set of instructions – just what I needed!

    Many thanks!

  8. Dpa on March 6th, 2013 9:32 pm

    Great instructions , I followed them and ran into one error which says Cannont find Webserver.

    I use 10.6.8 with mod_jk_1.2.37.
    any help is appreciated.

    thanks again

Leave a Reply

Before you post a comment please remember that commenting on my blog is a privilege not a right. I won't approve comments that are obscene, offensive or insulting. For more info please read this post.

Subscribe without commenting