How to mod_jk and Tomcat 5.5.17 integration on Windows


In this tutorial, apache2 server is installed through wamp server for PHP under c:/wamp/Apache2.

Download and install

Configuration

  • Java JDK path : C:\jdk1.5.0_07
  • Apache path : C:\wamp\Apache2
  • Tomcat path : C:\tomcat5
  • JSP/Servlet webroot (via Apache2/mod_jk) : C:\tomcat5\webapps
  • JSP/Servlet webroot (via native Tomcat server, port 8080) : C:\tomcat5\webapps
  • Access JSP/Servlet pages via Apache2/mod_jk : http://localhost/[jkmount-mapped url of your webapp]
  • Access native Tomcat server : http://localhost:8080/

Unpack and place Tomcat5 and mod_jk

  • Unpack file apache-tomcat-5.5.17.tar.gz under directory C:\
  • Rename directory C:\apache-tomcat-5.5.17 to C:\tomcat5
  • Rename file mod_jk-apache-2.x.xx.so to mod_jk.so, and place under directory C:\wamp\Apache2\modules. In wamp its already compiled and installed under c:/wamp/Apache2/modules

Configuration and Setup

workers.tomcat_home=C:/tomcat5
workers.java_home=C:/jdk1.5.0_07
ps=\
# Define worker 'example'
worker.list=example,worker1,worker2,worker3
# Set properties for worker 'example' (ajp13)
worker.example.type=ajp13
worker.example.host=localhost
worker.example.port=8009
worker.example.cachesize=10
worker.example.cache_timeout=600
worker.example.socket_keepalive=1
worker.example.recycle_timeout=300

# Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8109
# Set properties for worker2
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8209
# Set properties for worker3
worker.worker3.type=ajp13
worker.worker3.host=localhost
worker.worker3.port=8309

Edit file C:\wamp\Apache2\conf\httpd.conf, insert code

LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

Alias /jsp-examples "C:/tomcat5/webapps/jsp-examples/"
<directory>
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
</directory>

Alias /servlets-examples "C:/tomcat5/webapps/servlets-examples/"
<directory>
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
</directory>

<location /*/WEB-INF/*>
AllowOverride None
deny from all
</location>

JkMount /jsp-examples/*.jsp example
JkMount /servlets-examples/* example
</IfModule>

If you dont want to mount some files or directories, you can exclude using JkUnMount

Install and Start Tomcat

Tomcat can be installed as a Service or started as a Standalone Console application. Note to make sure that Apache has been started at this point.

Related Posts:

One Responses


pankaj January 7, 2008 at 5:43 am

I want tomcat software


Comments are closed.