• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

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

发布: 2007-6-22 07:38 | 作者: feng_sundy  | 来源: CSDN  | 查看: 41次 | 进入软件测试论坛讨论

领测软件测试网

   

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.

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网