Monday, December 17, 2012

Mod_jk connector to connect Webserver & Appserver


Mod_Jk Connector to connect web server(Apache) to application server (Tomcat)
Mod_jk is used to connect apache webserver with tomcat application server

Download the mod_jk connector from

Extract the file using below command
tar -xzvf apache-tomcat-6.0.18.tar.gz

Add the path of apxs to the env $PATH by
export PATH=$PATH:/home/subha/apps/webserver/httpd-2.2.11/bin/apxs

Go to this folder
cd tomcat-connectors-1.2.27-src/native
./configure  –with-apxs=/home/subha/apps/webserver/httpd-2.2.11/bin/apxs
make
make install (assuming the user is root)

Copy the file mod_jk.so to httpd-2.2.11/modules/ (if not already present)
-   vi /httpd-2.2.11/conf/workers.properties

Paste the following output into the file:
.tomcat_home=/home/subha/apps/appserver/apache-tomcat-6.0.18
workers.java_home=/usr/bin/java
ps=/
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=worker1

-   vi httpd.conf
-   Append the following to httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /home/subha/apps/webserver/httpd-2.2.11/conf/workers.properties
JkLogFile /home/subha/apps/appserver/apache-tomcat- 6.0.18/logs/mod_jk.log
JkLogLevel debug
JkMount /sample/* worker1
JkMount /sample1/* worker1
JkMount /servlet/* worker1
JkMount /*.jsp worker1
-   Test by http://localhost/sample/

No comments:

Post a Comment