How to integrate Apache 2 with Tomcat 4 on
Windows? |
Abstract: |
This text covers the installation of
Apache 2 and Tomcat 4 and the configuration of Apache 2 to
integrate Tomcat 4 using mod_jk2.
These instructions have been tested on Windows 2000 with Apache
2.0.47 and Tomcat
4.1.24. | |
Prerequisites: |
Properly installed J2SE SDK with
JAVA_HOME set in your
environment. | |
Install Apache 2: |
1. |
Download the Windows binaries:
apache_2.0.47-win32-x86-no_ssl.exe |
2. |
Install Apache 2 by double-clicking on the downloaded file and
following the prompts. | |
Install Tomcat
4: |
1. |
Download the Windows binaries:
tomcat-4.1.24.exe |
2. |
Install Tomcat 4 by double-clicking on the
downloaded file and following the
prompts. | |
Install
mod_jk2: |
|
You have to use the
correct version of mod_jk2.dll for your Apache 2 server
version.
In this example Apache 2.0.47 is used! |
1. |
Download or compile the Windows
binaries: mod_jk2_2.0.47.dll |
2. |
Copy mod_jk2_2.0.47.dll to
the modules directory of your Apache 2 installation
directory. | |
Configure Apache
2: |
1. |
Edit the httpd.conf file in
the conf directory of your Apache 2 installation
directory. |
|
Add to the end of the Dynamic Shared Object
(DSO) section the following:
[...]
#
# Dynamic Shared Object (DSO) Support
#
[...]
LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so
LoadModule jk2_module
modules/mod_jk2_2.0.47.dll
|
2. |
Create a new file named
workers2.properties in the conf directory of your
Apache 2 installation directory.
By default Apache 2 comes without this file and also Tomcat 4
does not provide one with the binary
distribution. |
|
workers2.properties
#--- workers2.properties
# Define the TCP socket communication channel for Tomcat
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
debug=0
[status:]
info=Status worker, displays runtime information.
# Map "jkstatus" to the Webserver uri space
[uri:/jkstatus/*]
info=Displays status information and checks the config file for
changes.
group=status:
# Resource used by "jkstatus" application.
[shm]
info=Scoreboard. Required for reconfiguration and status with
multiprocess servers.
file=C:\server\ApacheGroup\Apache2\logs\shm.file
size=1000000
debug=0
# Map the Tomcat "examples" webapp to the Webserver uri space
[uri:/examples/*]
info=Example webapp in the default context.
#--- end of workers2.properties
This is a sample file. You have to adjust the path in the
[shm] section to your system.
If you install your own application on Tomcat you have to add a
[uri:/yourApp/*] mapping in the workers2.properties
file. Otherwise Apache can not redirect the request to
Tomcat.
| |
Start Apache and
Tomcat: |
|
It is highly recommended to start
Tomcat first and then start Apache.
If you have to restart Tomcat it is recommended to restart Apache
too. |
1. |
Tomcat:
If you installed Tomcat as NT service restart it.
Go to Start > Settings > Control Panel >
Administrative Tools > Services .
Select the Tomcat 4 service and restart it.
Start Tomcat manually:
Go to the bin directory in the Tomcat installation
directory and start Tomcat:
startup
If Tomcat already runs as NT service you will get an error
message! |
2. |
Apache is installed as NT
service, there are two alternatives to restart it:
Alternative 1:
Restart Apache service using Apache Service Monitor.
Alternative 2:
Go to Start > Settings > Control Panel >
Administrative Tools > Services .
Select the Apache 2 service and restart it.
|
3. |
Test the configuration:
Open your browser and enter the following URL:
http://localhost/jkstatus
Your browser shows status information for the mod_jk2
connection.
http://localhost/examples
Your browser shows the directory listing of the Tomcat examples
in Tomcat
format.
| |