Configuration requirements: IIS (comes with win2000 server), Java 2 SDK 1.4.2 (or higher), Tomcat Web Server connector, Tomcat 5.0.24 (or higher)
preparation
1, Java 2 SDK 1.4.2 ( or later)
1. Download from www.java.sun.com/downloads/ website and select
2. Java 2 Platform, Standard Edition (J2SE)
3. Select All platforms in the drop-down list box
4. Select under J2SE v 1.4.2_04 SDK includes the JVM technology
5. Download J2SE SDK
6. Select accept and download Windows Offline Installation, Multi-language (j2sdk-1_4_2_04-windows-i586-p.exe, 49.36 MB) version
2, Tomcat 5.0.24 (or higher)
1. Download from http://jakarta.apache.org/site/binindex.cgi
2. Select Binaries in Downloads
3. Select 5.0.25 exe PGP MD5 download in Tomcat 5.0.25 KEYS
3. Tomcat Web Server Connector
1. Download from http://jakarta.apache.org/site/binindex.cgi
2. Select Binaries in Downloads
3. Select in Tomcat Web Server Connectors KEYS
4. JK 2
JK 2 Binary Releases
5. Index of/dist/jakarta/tomcat-connectors/jk2/binaries appears
interface, select win32/ and then select download
jakarta-tomcat-connectors-jk2.0.4-win32-IIS.zip
Note that the file names displayed in this directory list are truncated, so you need to observe the prompts in the browser status bar to confirm that the file you are about to download should end with "...iis.zip"
Installation
1. Java 2 SDK
Run j2sdk-1_4_2_04-windows-i586-p.exe and follow the prompts to install (you can change the installation path to a place you are used to). Choose here
d:\jdk (jdk creates a folder for itself)
2. Tomcat 5
Run jakarta-tomcat-5.0.24.exe and follow the prompts to install (you can change to other paths).
Select d:\tomcat5.0 here (tomcat5.0 created a folder for itself)
Select the jdk path of the local machine. Under normal circumstances, the installation file will be automatically searched and displayed. If it is not displayed correctly, you can also change it manually. After successful installation, the program will prompt to start tomcat and view the readme document.
Note: Before starting Tomcat, make sure that no other services in the system have occupied port 8080 (Tomcat's default port) and port 8009 (Tomcat's AJP13 connector port)
After Tomcat starts normally, the icon will be loaded in the system bar. Note: Versions below tomcat 5.0 must set an initial password, and versions above tomcat 5.0 do not need to set
one. 3. Tomcat JK2 IIS connector decompression jakarta-tomcat-connectors-jk2.0.4- win32-IIS.zip obtains three folders: bin conf doc. After entering \bin\, isapi_redirector2.dll can be seen.
Cut/copy the isapi_redirector2.dll file to the Tomcat's bin\ directory, create a new directory win32\i386\ and paste isapi_redirector2.dll.
Remember this path, you will use it later when configuring IIS. This path is not required by the system and can be changed!
Now you can delete the jakarta-tomcat-connectors-jk2.0.4-win32-IIS directory. The files in it are no longer useful. In fact, in jakarta-tomcat-connectors-jk2.0.4-win32-IIS.zip, we only use isapi_redirector2.dll file
settings 1. tomcat
Go to Tomcat's conf\ folder.
To support the JK2 connector, you may need to modify the jk2.properties file. In most cases, you can leave this file in its default state. I have not modified this file during multiple configuration processes.
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.
## COMMENTS WILL BE _LOST_
## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.
# Set the desired handler list
# handler.list=apr,request,channelJni
# www.downcodes.com
# Override the default port for the socketChannel
# channelSocket.port=8019
#Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so
# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess
request.tomcatAuthentication=false
Set the environment variable tomcat_home. Point to the tomcat installation directory d:\Tomcat 5.0. Note that the system is required to have the JAVA_HOME environment variable available
and create workers2.properties under d:Tomcat 5.0conf. The workers2.properties content file is as follows:
[shm]
file="d:/Tomcat 5.0/logs/jk2.shm"
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:/*.jsp]
[uri:/servlet/*]
worker=ajp13:localhost:8009
3. Tomcat IIS Connector You have placed isapi_redirector2.dll in your path, in this example
d:\Tomcat 5.0\bin\win32\i386
Now you need to add some necessary registration information to the registry, which will be read when the redirector is called by IIS. Create a .reg file
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\2.0]
"workersFile"="d:\\Tomcat 5.0\\conf\\workers2.properties"
"extensionUri"="/jakarta/isapi_redirector2.dll"
"logLevel"="debug"
"serverRoot"="d:\\Tomcat 5.0\\"
Write the above text in notepad and save it as reg.reg
Double-click the .reg file and the contents in the registry will be added successfully.
It can be seen in HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\2.0.
4. Configure multiple virtual host sites for Tomcat.
Create two new folders d:\tomcat1 and d:\tomcat2. Create a ROOT directory in each of the two folders.
Open the d:\Tomcat5.0\conf\server.xml file in Notepad. Find the tag in the file server.xml; create the following information after the tag:
www.tomcat1.com " appBase="d:\tomcat1" >
www.tomcat2.com " appBase="d:\ tomcat2">
The main thing is to create two new virtual hosts www.tomcat1.com and www.tomcat2.com . The site directories are d:\tomcat1 and d:\tomcat2 respectively. d:\tomcat1\ROOT and d:\tomcat2\ROOT. They are the home directories of the two sites respectively. Log files and access log files are also created.
5. Open the mapping of /servlet/* of tomcat.
Open the d:\Tomcat 5.0\conf\web.xml file in Notepad.
Bundle
invoker
org.apache.catalina.servlets.InvokerServlet
debug
0
2
and
invoker
/servlet/*
Remove the comments from these two code snippets to make them effective.
6. Create two sites tomcat1 and tomcat2 in iis. When creating, please note that the host headers are set to www.tomcat1.com and www.tomcat2.com respectively. The main directories are set to d:\tomcat1\ROOT and d:\tomcat2\ROOT respectively. The two sites established ISAPI filters named jakarta respectively. The executable files all point to d:\Tomcat 5.0\conf\connector\isapi_redirector2.dll.
Create new virtual directories for both sites and fill in the alias: jakarta. The directory selection points to: d:\Tomcat 5.0\bin\win32\i386. Check the "Execute (such as ISAPI application or CGI)" item. ,Finish.
When selecting the filter for the IIA filter, select the jakarta executable file as d:\Tomcat 5.0\bin\win32\i386
Select the virtual directory required to build the filter and load the Tomcat service site, right-click and select New, and then select the virtual directory. Create a virtual directory with the alias jakarta. Note that this name is a fixed value, don’t misspell it! The specified directory is the directory where isapi_redirector2.dll is located. In this example, it is d:\Tomcat 5.0\bin\win32\i386
Restart tomcat and iis.
It is best to put an index.htm and an index.jsp file under the tomcat1 and tomcat2 folders to facilitate testing.