feng_sundy 的专栏

网站建设,深圳网站建设,网页设计深圳,平面设计,深圳平面设计,深圳多媒体设计

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

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.

发表于 @ 2006年04月18日 15:31:00|评论(loading...)

新一篇: Windows 的命令行来操作 MySQL 的指令 | 旧一篇: 公共服务电话

用户操作
[即时聊天] [发私信] [加为好友]
feng_sundy
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
feng_sundy的公告
最近太多垃圾评论,暂时关闭评论,有问题,Email联系或者留言。
如有转载敬请注明出处。版权所有
feng_sundy © 2004-2008
sundysea@hotmail.com
sundysea@gmail.com
\ \ \ \ \
文章分类
收藏
DHTML & CSS
CSS alistapart.com
DHTMLGoodies
dudo博客
FCKEditor
Google Code
Google Web Toolkit
HTML Goodies
HTML.it
HTMLAre
HTMLdog
http://developer.yahoo.com/
JavaScript Kit
JQuery
KindEditor
Prototype
Tab Menu(exploding-boy.com)
TinyMCE
VBScript RegExp Object
W3 Schools
Yahoo JavaScript Developer Center
Yahoo! UI Library (YUI)
摄氏零度以后Jim's Blog
正则表达式
网页设计师Web标准
Javascript
Datejs.com
Drag drop JS
javascript.about.
leigeber.com
w3school
Java代码
codeproject.com
Eclipse Web Tools
Java.util
Java图像处理类库
Java处理Gif图片
Java学习源代码检索中心
Java开源大全
subversion
JSON VS XML
www.json.org
Mysql
Mysql Blog
N人Blog
idv2.com
meizz
nightsailer
Rubic's Cube Solution
Script.aculo.us开发系列
涤心斋
Prototype[script.aculo.us]
电影
MTime
tom365
软件下载
windows系统优化
心海e站
网站素材
IT墨水瓶
站酷(ZCOOL)_酷站
文档分享
分享文档-分享你我的Java文档
友情链接
feng ye
JavaScript tutorial and free code scripts
Java之路
Linux技术中坚站论坛
LVS中文站点
lxgljj的专栏
Movies手册
MyJsFrame
Windows Live
专注WEB开发
中国Linux公社
分享Java快乐
注册码大全
泽欧里 Zeal Li
老康之家
车东 Che, Dong
键者天行
阿赖的个性空间(RSS)
雕刻时光
黑夜路人的开源世界
自助建站
『更新易網』
【商贸易】系统
Affiliate Program Center
Builder spot
e Biz Webpages
Hishop 电子商务平台
Mambo Server
Mambo Server
Mambo中国
Members Section
Online web site builder
oscommerce
osCommerce Templates
ShopEx
SWsoft
UltraCMS
Web Design Library
Web2Go自動網頁
WebCortex
乔客在线
大中华商贸网
梦想家网店系统
存档
Csdn Blog version 3.1a
Copyright © feng_sundy