May
5
Installing mod_jk for Apache 2.2 on Mac OS X 10.5 Leopard
Filed Under Computers & Tech, System Administration on May 5, 2009 at 10:02 pm
Note: these instructions also work on OS X 10.6 Snow Leopard, and OS X 10.7 Lion
A 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 of googling and trial an error, but I’ve found a solution that works, which I’m going to share here. This solution is, in my opinion, a best practices solution, and does not involve any changes to your core apache configuration file (httpd.conf
). These instructions are for the default install of Apache 2.2 that comes pre-installed on OS X 10.5 Leopard. I can verify that these instructions work for Tomcat 5.0.30, but I would be 99% sure they should also work un-changed for Tomcat 5.5.X and Tomcat 6.0.X.
The obvious first step is to download the latest version of the mod_jk
Connector from the Apache site (download the .tar.gz
source file). I tested these instructions using version 1.2.28. Once you have the file downloaded extract it by double-clicking it in the Finder. Then launch the Terminal and change into the folder you just extracted from the .tar.gz
file. From this location execute the following commands:
$ cd native $ ./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs $ make $ sudo make install
Please note that these instructions are for 64bit Intel machines (Core 2 Duo and above), if your machine has a 32bit Intel processor (e.g. Core Duo or Core Solo) replace all instances of x86_64
with i386
, similarly 32bit PowerPC users (i.e. G4 users) should replace all instance of x86_64
with ppc
, and 64bit PowerPC users (i.e. G5 users) with ppc64
.
If the above Terminal commands execute without errors you have successfully compiled and installed mod_jk
. In order to start using it you will need to do two more things. Firstly, you will need to create the file /etc/apache2/other/workers.properties
and give it the following content:
# # The workers that jk should create and work with # worker.list=ajp13 # # Defining a worker named ajp13 and of type ajp13 # Note that the name and the type do not have to match. # worker.ajp13.type=ajp13 worker.ajp13.host=localhost worker.ajp13.port=8009
And secondly, you will need to create the file /etc/apache2/other/mod_jk.conf
and give it content something like the following, substituting in your own JkMount directives at the end:
# Load mod_jk module # Update this path to match your modules location LoadModule jk_module libexec/apache2/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/apache2/other/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /var/log/apache2/mod_jk.shm # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile /var/log/apache2/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # Send everything for context /example to worker named ajp13 JkMount /example/* ajp13
That’s it, just verify that you don’t have any issues with your config by running:
$ sudo apachectl configtest
Then just restart Apache to load up the new configuration:
$ sudo apachectl restart
Would this work for JBoss too, I can’t remember if mod_jk is specific to Tomcat or if it is for all java servers
Thanks for the info, I ran into the same issues you did when trying to build for Leopard.
@razmaspaz – Assuming you’re using Apache 2 to talk with jbossweb/tomcat (the default web server in JBoss) this should work fine. That’s what I’m doing. Apache 2.2 -> JBoss 5
Thanks so much for these instructions. Made my life a lot easier!
Hello,
Thanks for your post. I find it very usefull. But there is a little error inside. Could you change the flag arch to ppc64 as ppc_64 or PPC_64 does not existe and leads to the following error :
checking for C compiler default output file name… configure: error: C compiler cannot create executables
Cheers
JLuc
Thanks Jean-Luc, I’ve edited the post to fix the mistake.
Bart.
Thanks a lot Bart. You saved hours of my life. I confirm that above works as is for JBoss 6 and OS X 10.6.7 too.
Tamas
Thanks for reporting back Tamas, great to know these instructions are still good on Snow Leopard!
Bart.
Doing this on OSX 10.6.8 with native Apache2 and Tomcat 7.0.21. Only ran into one issue so far. Didn’t have Xcode installed so I didn’t have “make”. Downloading Xcode now and should be back on the road soon. Will let you know how it goes. Thanks for the article!
Just finished doing this with OS X Lion, Tomcat 7.0.22, and mod_jk 1.2.32 and all works exactly as described in the tutorial. Thanks! This saved me much Googling.
Hi Vince,
Thanks for letting me know these instructions are still good in 10.7!
Bart.
Hi
Im new at using Xcode and i have a question that perhaps isnt directly connected to mod_jk. Can you “make” the mod_jk on one mac and use it on another? or does the make have to take place on the machine that it supposed tu use the files?
i have a server that i want to use what you describe in your posts here, do i have to install Xcode on the server or can i use my macbook to make the mod_jk and then move files over to the server?
Regards
Mikael
Hi Mikael,
I haven’t done it myself, but in theory, if the Macs have the same OS and the same CPU architecture, then yes, you should be able to make on one and install on many.
Bart.
Hi and thanks for this precious guide!
It works on Mountain Lion too!
The only stop is when you try to create the executable, you get checking for C compiler default output file name… configure: error: C compiler cannot create executables.
The issue is the missing folder OSX10.8.xctoolchain into /Applications/Xcode.app/Contents/Developer/Toolchains
In MacOs 10.8 it is called XcodeDefault.xctoolchain.
I simply copied and renamed this one!
Thanks for this article. It worked on my first attempt itself.
Hi Bart! Thank you for this detailed instructions. For my part it doesn’t work: Mac 10.8.3, Apache Tomcat 7.0.34, Apache/2.2.22, Xcode 4.6.2 … Tried combinations of ./configure, “Mario’s (October 16th, 2012 10:05 am)” with OSX10.8.xctoolchain stuff in Xcode… no success.
All that stuff at /usr/local/tomcat-connectors-1.2.37/native/
Always the same message: checking for C compiler default output file name… configure: error: C compiler cannot create executables
No chance, no luck!
Tried and install dnsmasq with help at http://www.justincarmony.com/blog/2011/07/27/mac-os-x-lion-etc-hosts-bugs-and-dns-resolution/ (just in case)…
The last line of config.log: configure: exit 77 (???)
No mod_jk… grhhhhh!
Hi Bart!
Surfing around the web gave me the solution :
http://apple.stackexchange.com/questions/58186/how-to-compile-mod-wsgi-mod-fastcgi-etc-on-mountain-lion-by-fixing-apxserror
i.e. sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
It works…
Thanks you all!
I had the same issue building mod_jk on Moutain lion.
I would recommand to follow this link since it give help