IIS and Tomcat5 multi-site configuration
Date: 2004-06-24 Author: chen123
Configuration requirements: IIS (Win2000 Server self-contained), Java 2 SDK 1.4.2 (or higher), Tomcat Web Server Connector, Tomcat 5.0.24 (or higher)
ready
First, Java 2 SDK 1.4.2 (or higher) 1, www.java.sun.com/downloads / website download, select 2, Java 2 Platform, Standard Edition (J2SE) 3, select in the drop-down list box All platforms4, J2SE v 1.4.2_04 SDK includes the JVM technology choice under 5, Download J2SE SDK6, select accept to download Windows Offline Installation, Multi-language (j2sdk-1_4_2_04-windows-i586-p.exe, 49.36 MB) version
Second, Tomcat 5.0.24 (or higher) 1, http://jakarta.apache.org/site/binindex.cgi Download 2, select Binaries 3 in Downloads, select 5.0.25 in Tomcat 5.0.25 Keys EXE PGP MD5 download
Third, Tomcat Web Server Connector 1, http://jakarta.apache.org/site/binindex.cgi download 2, select Binaries 3 in Downloads, select 4 in Tomcat Web Server Connectors Keys, JK 2 JK 2 Binary Releases 5, an index of / dist / jakarta / tomcat-connection / jk2 / binaries interface, select Win32 / then select Download Jakarta-Tomcat-Connectors-jk2.0.4-win32-iis.zip Note that this directory list displayed file name is truncated Therefore, you need to observe the prompt in the browser status bar to confirm that the file you prepare to download should be ended in /"...iis.zip/
installation
First, Java 2 SDK runs J2SDK-1_4_2_04-Windows-i586-P.exe follows the prompt installation (you can change the installation path to your habit). Here you choose D: // JDK (JDK for your own new folder)
Second, Tomcat 5 run jakarta-tomcat-5.0.24.exe follows the prompt installation (which can be changed to other paths). Here, D: Tomcat 5.0 is selected for your own new folder) Select the JDK path of the local machine. In general, the installation file will automatically search and display. If there is no correct display, you can also change successfully. The program will prompt to start Tomcat and view the ReadMe document. Note: Before starting Tomcat, you must determine that the system has no other service already occupies 8080 port (Tomcat default port) and 8009 port (Tomcat / 'S AJP13 connector port) Tomcat is started after normal startup, pays up the icon at system bar Note: Tomcat5.0 or less The version must set up the initial password, the Tomcat 5.0 or more can not be set
Third, Tomcat JK2 IIS connector decompresses jakarta-tomcat-connectors-jk2.0.4-win32-iis.zip Get three folders from Bin Conf Doc, and then ISAPI_Redirector2.dll can be seen after entering // bin //. Cut / copy ISAPI_REDIRECTOR2.DLL file to Tomcat / 's bin // directory New Directory Win32 // i386 / / and paste ISAPI_Redirector2.dll. Remember this path, it will be used when you configure IIS. This path is not the system requirements, can change! Now you can delete the Jakarta-Tomcat-Connector-JK2.0.4-Win32-IIS directory, which is no longer available. In actually in Jakarta-Tomcat-Connectors-jk2.0.4-win32-iis.zip, we only use ISAPI_Redirector2.dll a file settings. Tomcat enters the Tomcat / 's conf // folder. To support JK2 connector, you You may need to modify the JK2.Properties file. Most cases reserved the default state of this file, and the multiple configuration procedures have not modified this file.
## this file may be overriden at runtime. Make sudu. Make tomcat is stock ##. 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 ## 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 folowing directives:
# apr.jnimodeso = / opt / apache2 / modules / mod_jk2.so
# I set to inprocess the mod_jk2 will register natives itself # this will enable the starting of the tomcat from mod_jk2 # apr.jnimodeso = INPROCESSREQUEST.TOMCATAUTHENTICATION = FALSE
Set the environment variable tomcat_home. Point to Tomcat installation directory D: // Tomcat 5.0. Note that the system has a java_home environment variable
Create workers2.properties to d: // Tomcat 5.0 // confes. 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 = 8009Host = 127.0.0.1
# Define the workerhost: 8009] channel: localhost: 8009 # uri mapping [uri: / *. jsp] [uri: / servlet / *] worker = ajp13: localhost: 8009
Third, Tomcat IIS Connector You have already placed isapi_redirector2.dll under your path, this example is D: // Tomcat 5.0 // bin // Win32 // i386 now need to add some necessary registration information to the registry, Redirector Read it when you are 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.0confworkers2.properties/"/"extensionUri/"=/"/ JAKARTA / ISAPI_REDIRECTOR2.DLL / "/" Loglevel / "= /" debug / "serverroot /" = / "d: tomcat 5.0 /" writes the text above in Notepad and saves to REG.REG double click. The REG file, the content in the registry will add success hkey_local_machine // Software // Apache Software Foundation // Jakarta ISAPI Redirector // 2.0 can be seen in.
Fourth, formulate multiple sites for Tomcat. Newly built two folders D: // Tomcat1 and D: // Tomcat2. Establish a root directory again in the two folders.
Notepad opens the D: Tomcat 5.0//conf//server.xml file. Locate the label in the file server.xml; newly created the following information after the label:
Www.tomcat1.com/ "AppBase = /" D: // Tomcat1 / ">
Www.tomcat2.com/ "AppBase = /" D: // Tomcat2 / ">
Mainly new two virtual hosts www.tomcat1.com and www.tomcat2.com. The site directory is D: // Tomcat1 and D: // Tomcat2. D: // Tomcat1 // root and d: // Tomcat2 // root. They are the main directory of two sites. Log files and access log files are also established.
5. Open the map of Tomcat / servlet / *. Notepad opens the D: // Tomcat 5.0 // conf //web.xml file. Put
Invoker
Org.apache.catalina.servlets.invokerseervlet
Debug
0
2
with
Invoker
/ servlet / *
The annotation of the two code segments removed to take effect.
6. Create two sites Tomcat1 and Tomcat2 in IIS. Pay attention to the header heads in www.tomcat2.com and www.tomcat2.com. The home directory is set to D: // Tomcat1 // root and d: // Tomcat2 // root. Two sites establish a ISAPI filter named Jakarta, respectively. Executable files point to D: // Tomcat 5.0 // conf // connector // isapi_redirector2.dll.
Two sites are newly built virtual directory alias, respectively: jakarta, directory selection pointing: D: // Tomcat 5.0 // bin // Win32 // i386 in / "Execute (such as ISAPI app or cgi) /" one item hook ,carry out. When the IIA filter is selected, select the Jakarta executable file to D: // tomcat 5.0 // bin // Win32 // i386
The virtual directory you need to build the filter device Select to load the Tomcat service site, right-click to select new, then select the virtual directory. Create a virtual directory, alias is Jakarta. Note that this name is a fixed value, don't spell your error! The specified directory is ISAPI_Redirector2.dll where the directory is located. This example 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. Convenient to test.