This post briefly explains how to compile mod_jk on the Centos6.3 OS.

Mod_jk is an Apache module that is used to connect Tomcat to Apache Http server or other web servers.

System Setup
OS: Centos 6.3
Webserver: Apache Http Server 2.2.15
Application Server:  Tomcat 7.0.27
Application: Liferay Enterprise  6.1.20

Directions:

Download the source for mod_jk at http://tomcat.apache.org/download-connectors.cgi.

Extract the .tar.gz archive. The following will assume that the archive was downloaded to the /home/liferay/liferay-install/ directory:

tar -zxvf /home/liferay/liferay-install/tomcat-connectors-1.2.37-src.tar.gz

Change to the native folder within the newly created tomcat-connectors-1.2.37-src folder

Download the prerequisite libraries to compile the source code

sudo yum install httpd-devel
sudo yum install gcc gcc-c++
sudo yum install make

Change permissions on the configure file, if necessary

chmod u+x configure

Run configure with the appropriate options

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

Change permissions of the instdso.sh file (within the /home/liferay/liferay-install/tomcat-connectors-1.2.37-src/native/scripts/build/directory), if necessary.

 cd scripts/build
chmod u+x instdso.sh

In the native directory, run the make command

make

The file is now compiled and called mod_jk.so.  It is located within the /home/liferay/liferay-install/tomcat-connectors-1.2.37-src/native/apache-2.0 directory

Copy the compiled mod_jk.so module to the httpd/modules directory and configure Apache to include it.

Credit to Jack Chung for the bulk of the article.

Share This