IIS and tomcat 5 multi-site configuration

Source: Internet
Author: User

Date: Author: chen123

Configuration Requirements: IIS (comes with Win2000 Server), Java 2 SDK 1.4.2 (or later), Tomcat web server connector,

Tomcat 5.0.24 (or later)

Preparation

I. Java 2 SDK 1.4.2 (or later)

1. Download from www.java.sun.com/downloads/, and select

2. Java 2 platform, Standard Edition (j2se)

3. Select all platforms from the drop-down list box.

4. Under j2se v 1.4.2 _ 04 SDK schemdes the JVM technology, select

5. Download j2se SDK

6. Select accept and Download Windows offline installation, multi-language (j2sdk-00004_2_04-windows-i586-p.exe, 49.36 MB ).

Ii. Tomcat 5.0.24 (or later)

1. Download http://jakarta.apache.org/site/binindex.cgi

2. Select binaries in downloads

3. Select 5.0.25 exe pgp MD5 download from Tomcat 5.0.25 keys.

Iii. Tomcat Web Server Connector

1. Download http://jakarta.apache.org/site/binindex.cgi

2. Select binaries in downloads

3. In Tomcat web server connectors keys, select

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 name displayed in this directory list is truncated, so observe the prompt in the browser status bar to confirm that the file you are about to download should end with \ "...iis.zip \"

Install

I. Java 2 SDK

Run j2sdk-00004_2_04-windows-i586-p.exe and follow the prompts to install it (you can change the installation path to your preferred location ). Select

D: \ JDK (JDK creates a folder for itself)

2. Tomcat 5

Run jakarta-tomcat-5.0.24.exe and install it as prompted (you can change it to another path ).

Select D :\\ tomcat5.0 (tomcat5.0 is the new folder)

Select the JDK path of the local machine. In general, the installation file is automatically searched and displayed. If it is not displayed correctly, you can manually change it.

After successful installation, the program prompts you to start Tomcat and view the README documentation.

Note: Before starting tomcat, make sure that no other service in the system has occupied port 8080 (default Tomcat port) and Port 8009 (Tomcat \'s ajp13 connector port)

After Tomcat is started normally, the icon is loaded in the system bar.

Note: The initial password must be set for versions earlier than Tomcat and later than tomcat.

Iii. Tomcat JK2 IIS Connector

Decompress jakarta-tomcat-connectors-jk2.0.4-win32-iis.zip to get the bin conf Doc three folders. After Entering \ bin \, You can see isapi_redirector2.dll.

Cut/copy the isapi_redirector2.dll file to the Tomcat \'s bin \ directory.

Create the Win32 \ i386 \ directory and paste isapi_redirector2.dll.

Remember this path, which will be used later when you configure IIS. This path is not required by the system. It can be changed!

Now you can delete the jakarta-tomcat-connectors-jk2.0.4-win32-IIS Directory, which is useless. In jakarta-tomcat-connectors-jk2.0.4-win32-iis.zip, we only use the isapi_redirector2.dll file.


Set

I. Tomcat

Go to the Tomcat \'s conf \ folder.

To support the JK2 connector, you may need to modify the jk2.properties file. In most cases, keep the default status of this file. I have not modified this file for many configuration procedures.

# 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

#

# Override the default port for the socketchannel

# Channel socket. Port = 8019

# Default:

# Channelunix. File =$ {jkhome}/work/jk2.socket

# Just to check if the config is working

# SHM. File =$ {jkhome}/work/jk2.shm

# In order to enable JNI use any channeljni direve ve

# Channeljni. Disabled = 0

# And one of the following ctictives:

# 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 atat_home. Point to the tomcat installation directory D: \ Tomcat 5.0. Note that the java_home environment variable must be available.

Create workers2.properties to d :\\ Tomcat 5.0 \ conf. 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

Iii. 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 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. The content in the registry is successfully added.

HKEY_LOCAL_MACHINE \ Software \ Apache Software Foundation \ Jakarta ISAPI redirector \ 2.0.

 

4. Prepare multiple sites for Tomcat as virtual hosts.

Create two folders, D: \ tomcat1 and D: \ tomcat2. Create a root directory in the two folders.

In notepad, open the D: \ tomcat5.0 \ conf \ Server. xml file. In the file server. XML, find

Tag. The following information is created after the tag:

Www.tomcat1.com \ "appbase = \" d :\\ tomcat1 \ ">


Www.tomcat2.com \ "appbase = \" d :\\ tomcat2 \ ">


It mainly creates two virtual hosts: www.tomcat1.com and www.tomcat2.com. The site directories are d :\\%at1 and D :\\ tomcat2. D: \ tomcat1 \ Root and D: \ tomcat2 \ Root. Are the home directories of the two sites. Log Files and access log files are also created.


5. Open tomcat/servlet/* ing.

Open the D: \ Tomcat 5.0 \ conf \ WEB. xml file in notepad.

Set



Invoker



Org. Apache. Catalina. servlets. invokerservlet





Debug

0



2



And



Invoker

/Servlet /*



Remove the comments of the two code segments to make them take effect.


6. Create two sites, tomcat1 and tomcat2, in IIS. When creating a host, set the Host header to www.tomcat1.com and www.tomcat2.com respectively. The main directory is set to d :\\ tomcat1 \ Root and D :\\ tomcat2 \ Root. The two sites respectively create an ISAPI filter named Jakarta. The executable files all point to d :\\ Tomcat 5.0 \ conf \ connector \ isapi_redirector2.dll.

Fill in "Jakarta" for the virtual directory alias created for the two sites respectively, and select "D:" For the directory: \ Tomcat 5.0 \ bin \ Win32 \ i386 on \ "execution (such as ISAPI application or cgi) \" to check and complete.


IIA Filter

When selecting a filter, select the Jakarta executable file D: \ Tomcat 5.0 \ bin \ Win32 \ i386

 


Virtual directory required for filter Creation

Select the Tomcat service site to be loaded, right-click and choose new, and then select the virtual directory. Create a virtual directory named Jakarta. Note that this name is a fixed value. Do not make spelling mistakes! Specify the directory where isapi_redirector2.dll is located. In this example, d :\\ Tomcat 5.0 \ bin \ Win32 \ i386

 

Restart Tomcat and IIS.

It is better to put an index.htm and an index. jsp file under tomcat1and tomcat2folders for convenient testing.


Feel good. paste it back.

QQ: 37856253

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.