分享
 
 
 

Apache-Tomcat的整合操作的英文介绍--用mod_jk2.so实现

王朝system·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

Integrating Apache 2.0 with Tomcat 5.5 for Windows

Background

This document outlines the process for integrating the Apache web-server with the Tomcat JSP/Servlet container. This configuration allows you to use Apache for serving static web content such as pure HTML pages while using Tomcat for dynamic content such as JSP pages and servlets. This configuration allows you to independently configure the two environments offering improvements in performance and scalability.

Prerequisites

Please refer to the following guide(s) and follow the instructions included within to install/configure the required software:

· Getting Started with Apache for Windows

· Getting Started with Tomcat for Windows

Download

1. Download the mod_jk2.so from jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49.zip

2. Download the Tomcat 4.1 from http://www.eu.apache.org/dist/jakarta/tomcat-5/v5.5.2/bin/jakarta-tomcat-5.5.2.exe

3. Download the Apache 2.0 from http://www.eu.apache.org/dist/httpd/binaries/win32/apache_2.0.51-win32-x86-no_ssl.msi

Notes:

1. The JK connector is now deprecated. Use the Coyote JK 2 connector noted above instead.

2. The version of mod_jk2.dll to download is dependent on the version of Apache that was installed (in this case Apache 2.0.43 was installed so the mod_jk2-2.0.43.dll is downloaded); it is not dependent on the version of Tomcat that was installed. Though noted for Apache 2.0.43 this connector will also work with Apache 2.0.50.

Installation

Configure Apache

1. Copy mod_jk2.so to the <apache-install-dir>\Apache2\modules directory (e.g. C:\Program Files\Apache Group\Apache2\modules)

2. Edit the Apache server configuration file httpd.conf. This file can be found in the <apache-install-dir>\Apache2\conf directory or can be accessed from the Start menu under Start -> Programs -> Apache HTTP Server 2.0.45 -> Configure Apache Server -> Edit the Apache httpd.conf Configuration File. Find the LoadModule section of the configuration file and add the following line with the other LoadModule entries:

LoadModule jk2_module modules/mod_jk2.so

3. In the <apache-install-dir>\Apache2\logs directory (e.g. C:\Program Files\Apache Group\Apache2\logs) create three empty files: stdout.log, stderr.log, and jk2.shm; make sure they aren’t saved with a different suffix.

4. In the <apache-install-dir>\Apache2\conf directory (e.g. C:\Program Files\Apache Group\Apache2\conf) create a new file called workers2.properties (make sure its not saved with an additional suffix), and type in the following lines (note: you may need to change the value of file to reflect your Apache installation):

If you are running Apache and Tomcat on the same machine then you would have the following workers2.properties:

[shm:]

file=C:\Program Files\Apache Group\Apache2\logs\jk2.shm

size=1000000

[channel.socket:localhost:8009]

port = 8009

host = 127.0.0.1

[ajp13:localhost:8009]

channel=channel.socket:localhost:8009

[uri:/jsp-examples/*]

[uri:/tomcat-docs/*]

worker=ajp13:localhost:8009

If you are running Apache and Tomcat on separate machines then you would have the following workers2.properties:

[shm:]

file=C:\Program Files\Apache Group\Apache2\logs\jk2.shm

size=1000000

[channel.socket:IPAddressOfTomcatMachine:8009]

port=8009

host=IPAddressOfTomcatMachine

[ajp13:IPAddressOfTomcatMachine:8009]

channel=channel.socket:IPAddressOfTomcatMachine:8009

[uri:/jsp-examples/*]

[uri:/tomcat-docs/*]

worker=ajp13:IPAddressOfTomcatMachine:8009

Where IPAddressOfTomcatMachine is the IP address of the machine on which Tomcat will be run (it can also be a machine name).

The last two lines in the workers2.properties file are used to configure the forwarding features of Apache. These lines tell Apache to contact Tomcat whenever the requested URL contains /jsp-examples or /tomcat-docs (these are the two web-apps deployed in Tomcat).

Instead of mapping the entire application to Tomcat, prefix or extension URI mappings can be defined so that Apache serves all static content and Tomcat serves all dynamic content. Please refer to the documentation link noted above for more details on this.

In any event, you should configure URI mappings to cover any installed web-apps that you may have in your environment. The examples given here are for the Tomcat examples and the Tomcat documentation.

Configure Tomcat

Note: You don’t have to modified the configure, leave it as default, just remind that start up Tomcat first, or you may check that

<Connector port="8009" enableLookups="false" redirectPort="8443" debug="0" protocol="AJP/1.3" />

should not be committed in the %TOMCAT_HOME%\conf\server.xml.

Note: Once you have Apache and Tomcat configured to work together you will no longer be able to use them as Windows Services. This is because this integration requires that Tomcat be started before Apache and there is no guaranteed to the order in which Windows services are started. Therefore, another mechanism must be used that allows for the specifying the order in which processes are started. If Apache and/or Tomcat are configured as Windows Services you will need to reconfigure them to start manually instead of automatic.

Test

1. If Tomcat is already running then stop it. Start Tomcat from the Start Menu or from a command prompt (if unsure how to do this, please refer to the installation guide for Tomcat).

2. If Apache is already running then stop it. Start Apache from the Start Menu or from the command prompt (if unsure how to do this, please refer to the installation guide for Apache).

3. Once both Tomcat and apache are running try the following URL’s to verify the integration:

a. Open http://localhost:8080/ in your browser – displays a Tomcat test page

b. Open http://localhost/ in your browser – displays an Apache test page.

c. Open http://localhost:8080/jsp-examples in your browser - displays the Tomcat examples directory listings (images, jsps, and servlets); the request is going directly to Tomcat.

d. Open http://localhost/jsp-examples in your browser - displays the Tomcat examples directory listings again; except this time the request is going through Apache; which routes it to Tomcat.

Note: the above URLs that are missing port number 8080 (see b and d); means that the request is going to the Apache HTTP server; instead of going directly to the Tomcat Web server.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有