Tuesday, August 21, 2012

Step by step Tomcat with Apache Integration on Linux server ?

# Installing and configuring mod_jk

To make connection between Tomcat and Apache, you will need to download and install mod_jk connector.

I chose to download the current source from the Apache archives:-

[root@map007 /]# cd /usr/local

[root@map007 local]# wget

[root@map007 local]# tar -zxvf jakarta-tomcat-connectors-1.2.15-src.tar.gz

Change to the /usr/local/jakarta-tomcat-connectors-1.2.15-src/jk/native directory.

[root@map007 local]# cd jakarta-tomcat-connectors-1.2.15-src/jk/native

Now you are ready to create the custom configure file for your system. Execute the following:

[root@map007 local]# ./

[root@map007 local]# ./configure –with-apxs=/usr/bin/apxs2

Now build the mod_jk with the following:

[root@map007 local]# make

Finally, if you were successful with the previous commands, copy the newly created mod_jk.soto your Apache2 modules directory. My modules were located at /usr/lib/apache2/modules.

[root@map007 /]# cp /usr/src/jakarta-tomcat-connectors-1.2.15-src/jk/native/apache-2.0/ /usr/lib/apache2/modules
 # Configuring Tomcat and Apache

[root@map007 /]# vi /etc/apache2/








  # Save and close the file.

# Now you have to configure httpd.conf file and following lines.

[root@map007 /]# vi /etc/apache2/httpd.conf

LoadModule jk_module /usr/lib/apache2/modules/

# Where to find

JkWorkersFile /etc/apache2/

# Where to put jk logs

JkLogFile /var/log/apache2/mod_jk.log

# Set the jk log level [debug/error/info]

JkLogLevel info

# Select the log format

JkLogStampFormat “[%a %b %d %H:%M:%S %Y] “

Save and close the file.

Now a final security point.

[root@map007 /]# chown -R tomcat:tomcat /usr/lib/apache-tomcat-5.5.16

# Now restart the Tomcat.

[root@map007 /]# cd /usr/local/tomcat/bin

[root@map007 bin]# ./

[root@map007 bin]# ./

And restart Apache:

[root@map007 /]# /etc/init.d/apache2 restart

You have Done all the Configurations.

Note :- Start Tomcat first: Always start Tomcat first and then start Apache.
References and paths:

Tomcat conf:


Apache modules:


Apache conf:



Tomcat stop and start:

cd /usr/local/apache-tomcat/bin




/etc/init.d/apache2 restart

/etc/init.d/apache2 stop

/etc/init.d/apache2 start

No comments:

Post a Comment