IIS integration Tomcat

Source: Internet
Author: User
Tags apache tomcat

I have seen many articles on IIS and tomcat integration on the Internet, but I have always encountered many problems when I practice them based on my articles, so I decided to summarize my experiment process.

First, describe the environment in which I have succeeded:

Win2ksp4 + tomcat5.5.23 + iis5.0

Winxpsp2 + tomcat5.5.23 + iis6.0

The configuration process is as follows: (make sure the file name is case-insensitive and the spelling is correct)

Prerequisites

○ Operating system + IIS (on the control panel of the operating system, add or delete a program, or delete a Windows component, or Internet Information Service)

○ Apache Tomcat 5.5.23 (other versions are not tested. It is estimated that all versions 5.5.x can be used)

○ JDK 5.0 (JDK 5.5 is required for Tomcat 5.0)

 Apache Tomcat Connector (isapi_redirect.dll file. You can enter http://www.apache.org/distto search for Tomcat --> connector --> bin)

Configuration steps:

1. Installation of the operating system and IIS

2. Install the Java Runtime Environment

3. Decompress or execute executable applications based on the downloaded Tomcat format. (If you download an executable installation program for Windows, you can directly install it)

4. Place the downloaded isapi_redirect.dll file in any local directory as jk_home. In the tomcat installation directory, the file structure is $ tomcat_home/JK/Win32. This structure is used because the 32-bit operating system and the isapi_redirect.dll file of the 64-bit operating system are different, for future expansion convenience and clear structure.

5. compile the isapi_redirect.properties file. At the beginning, I set the registry according to the method provided on the Apache official website. However, it is not convenient to directly write an attribute file during the process of adding content in the registry of the system. The following is an example of the isapi_redirect.properties file:

# Configuration file for the Jakarta ISAPI Redirector

# The Path to the ISAPI redirector extension, relative to the website

# This must be in a virtual directory with execute privileges

Extension_uri =/Jakarta/isapi_redirect.dll (fixed)

# Full path to the log file for the ISAPI Redirector

LOG_FILE = C:/Apache-Tomcat-5.5.23/logs/isapi_redirect.log (log location, location arbitrary)

# Log Level (debug, info, warn, error or trace)

Log_level = Info (log level, among the five types)

# Full path to the workers. properties File

Worker_file = C:/Apache-Tomcat-5.5.23/CONF/workers. properties (the workers attribute file is in any location, but this file must be created at the specified location)

# Full path to the uriworkermap. properties File

Worker_mount_file = C:/Apache-Tomcat-5.5.23/CONF/uriworkermap. Properties)

6. Compile the workers. properties and uriworkermap. properties files.

Two files are created at the locations defined in the isapi_redirect.properties file.

Workers. properties file content (the sample file can be modified as needed)

# Workers. properties. Minimal-

#

# This file provides minimal JK configuration properties needed

# Connect to Tomcat.

#

# The workers that JK shoshould create and work

#

Worker. List = lyworker

#

# Defining a worker named lyworker and of Type ajp13

# Note that the name and the type do not have to match.

#

Worker. lyworker. type = ajp13

Worker. lyworker. Host = localhost

Worker. lyworker. Port = 8009

Here the woker name is lyworker, the type is ajp13, the host is localhost, and the corresponding port number is 8009. This 8009 must correspond to the port number in the $ atat_home/CONF/server. xml file:

......

 

Enablelookups = "false" redirectport = "8443" protocol = "AJP/1.3"/>

......

Uriworkermap. properties file content:

# Uriworkermap. properties-IIS

#

# This file provides sample mappings for lyworker

# Worker defined in workermap. properties. Minimal

# The general syntax for this file is:

# [Url] = [worker name]

/Servlets-examples/* = lyworker

The above configuration shows that all requests under the/Servlets-examples directory are processed by lyworker, that is, they are sent to Tomcat and processed by the Tomcat container.

7. Create a filter:

Right-click the default web site option, select Properties, select ISAPI filter, and select Add:

The name of the filter is arbitrary. The executable file is isapi_redirect.dll.

After the application is created, click "application", and then click "OK. As shown in, if the arrow is green up, the filter is successfully configured; otherwise, the filter is red, indicating that the filter fails.

8. Create a virtual directory in IIS:

Open the Internet information service tool: Select Internet Information Service à ASI (your host name) à default web site, right-click and choose create virtual directory, as shown in:

In the displayed window, click Next and enter Jakarta in the virtual directory alias (the name is fixed), as shown in:

Click Next. In the content directory of the web site, Click Browse to select the directory where the isapi_redirect.dll file is located, as shown in:

In setting access permissions, select the execution permissions of the machine (third check box ):

After creation, add the Virtual Site Jakarta. After selection, the content in the directory is displayed on the right:

(Here, servlets-examples was created later. According to the initial situation, the content on the default web site may be different, but does not affect the configuration ).

Create the servlets-examples virtual directory in the same step. The directory content is C:/Apache-Tomcat-5.5.23/webapps/Servlets-examples, that is, the Directory of the servlets example program that comes with Tomcat. The execution permission is also granted.

9. Add the context element to the $ tomcat_home/CONF/server. xml file:

......

 

 

 

......

The premise is that the servlets-examples sample program is included in the $ tomcat_home/webapps directory during tomcat installation.

Save the settings.

10. An important step is to restart the computer after the settings are complete. Since I have not restarted my computer before, no matter how I start and stop Tomcat and IIS back and forth, the access is successful.

11. After restart, start the Tomcat server and the IIS Server (IIS is generally started along with the system). In the address bar, enter http: // localhost/Servlets-Examples

As the welcome page, reenter. Normally, the page is displayed successfully, for example:

It cannot be said that IIS and tomcat have been successfully integrated, because the page is static content, so you need to test and execute a servlet, click execute connection on the right of the Hello world application:

If the page shown is displayed, IIS and tomcat are integrated successfully:

The integration of Tomcat and IIS or Apache is very simple, mainly because the configuration is correct, and there are some slightly more advanced applications, such as request separation and multi-host. I will introduce it later.

For the syntax of the workers. properties file and uriworkmap. properties file, refer to the Apache official website.

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.