Tomcat 5.5.17, with mod_jk
Building a Web Server, for Windows
Requirements
- Java 1.5 JDK (SDK)
- Apache 2.0
- mod_jk 1.2
Download
- Java 1.5 JDK -- Select JDK 5.0 Update 7
- Select - Windows Offline Installation - file jdk-1_5_0_07-windows-i586-p.exe
- Tomcat 5.5.17 -- Select Binary Distribution, Core: apache-tomcat-5.5.17.tar.gz
- mod_jk 1.2.18 -- Download file mod_jk-apache-2.x.xx.so
[or use our mod_jk v1.2 Guide to build module from source]
Our Configuration
- Java JDK path : C:\jdk1.5.0_07
- Apache path : C:\www\Apache2
- Tomcat path : C:\www\tomcat5
- Apache's webroot : C:\www\webroot
- JSP/Servlet webroot (via Apache2/mod_jk) : C:\www\tomcat5\webapps
- JSP/Servlet webroot (via native Tomcat server, port 8080) : C:\www\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/
Install Java 1.5 JDK
- Run file jdk-1_5_0_07-windows-i586-p.exe
- Install under your %SystemDrive% (C:\), forming C:\jdk1.5.0_07
Unpack and place Tomcat5 and mod_jk
- Unpack file apache-tomcat-5.5.17.tar.gz under directory C:\www
- Rename directory C:\www\apache-tomcat-5.5.17 to C:\www\tomcat5
- Rename file mod_jk-apache-2.x.xx.so to mod_jk.so, and place under directory C:\www\Apache2\modules
Configuration and Setup
- Set Environmental Variables : JAVA_HOME=C:\jdk1.5.0_07 and CATALINA_HOME=C:\www\tomcat5
- Set variables under Start » Settings » Control Panel » System » Advanced » Environment Variables » System variables » New...
- Create empty file C:\www\Apache2\conf\workers.properties, insert code...
workers.tomcat_home=C:/www/tomcat5 workers.java_home=C:/jdk1.5.0_07 ps=\ # Define worker 'example' worker.list=example # 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
- Edit file C:\www\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:/www/tomcat5/webapps/jsp-examples/" <Directory "C:/www/tomcat5/webapps/jsp-examples/"> Options Indexes +FollowSymLinks AllowOverride None Allow from all </Directory> Alias /servlets-examples "C:/www/tomcat5/webapps/servlets-examples/" <Directory "C:/www/tomcat5/webapps/servlets-examples/"> 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> - Edit file C:\www\tomcat5\conf\tomcat-users.xml, insert lines...
- <role rolename="manager"/>
- <user username="manager" password="manager" roles="manager"/>
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.
Tomcat Service
- Open the command-line prompt (Start » Run... cmd.exe)
C:\www\tomcat5\bin> service.bat install
[Note that this Service is installed, by default, as StartUp Type "manual": you will need to start this Service manually each time your system boots]
[To change this Service's StartUp Type to "Automatic": Start » Run... services.msc, Locate "Apache Tomcat5", Change StartUp Type to "Automatic"]...> NET START Tomcat5
- To shutdown the Tomcat Service :
...> NET STOP Tomcat5 - To remove/uninstall the Tomcat Service :
C:\www\tomcat5\bin> service.bat remove
Standalone Console application
- Open the Command-Shell (Start » Run: cmd.exe), change to dir C:\www\Tomcat5\bin...
- Run file startup.bat to start Tomcat
- Run file shutdown to shutdown Tomcat
Test Tomcat5/mod_jk
- Test the native Tomcat server...
- http://localhost:8080/
- http://localhost:8080/manager/status -- User:manager, Password:manager
- Test Apache/mod_jk...

