尚学堂.张志宇.TOMCAT集成APACHE.doc_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 尚学堂.张志宇.TOMCAT集成APACHE.doc

尚学堂.张志宇.TOMCAT集成APACHE.doc

 2012/2/24 9:58:30  bjrobin  程序员俱乐部  我要评论(0)
  • 摘要:TOMCAT集成APACHE1准备下载软件1.1Apache文件名:apache_2.2.11-win32-x86-openssl-0.9.8i.msi下载地址:http://apache.freelamp.com/httpd/binaries/win32/apache_2.2.11-win32-x86-no_ssl.msi1.2Tomcat文件名:apache-tomcat-6.0.18.zip下载地址:http://labs.xiaonei.com/apache
  • 标签:Tomcat Apache

?

TOMCAT 集成 APACHE

1?????? 准备

下载软件

1.1?? Apache

文件名

apache_2.2.11-win32-x86-openssl-0.9.8i.msi

下载地址:

http://apache.freelamp.com/httpd/binaries/win32/apache_2.2.11-win32-x86-no_ssl.msi

?

1.2?? Tomcat

文件名:

apache-tomcat-6.0.18.zip

下载地址:

http://labs.xiaonei.com/apache-mirror/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip

1.3?? mod_jk

文件名:

mod_jk-1.2.27-httpd-2.2.10.so

下载地址:

http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.27/mod_jk-1.2.27-httpd-2.2.10.so

2?????? 安装 apache

假设安装目录是: C:\Apache2.2

端口默认 80

3?????? 安装 tomcat

假设安装路径是: C:\apache-tomcat-6.0.18

端口默认 8080

4?????? 配置 apache

4.1?? 拷贝文件 mod_jk-1.2.27-httpd-2.2.10.so

拷贝文件 mod_jk-1.2.27-httpd-2.2.10.so C:\Apache2.2\modules 。并且改名为 mod_jk.so

4.2?? 建立文件 workers.properties

建立文件 C:\Apache2.2\conf\ workers.properties

? worker.list=worker1

? worker.worker1.type=ajp13

? worker.worker1.host=localhost

? worker.worker1.port=8009

4.3?? 修改文件 httpd.conf

找到 C:\Apache2.2\conf\ httpd.conf 文件。

修改原有 DocumentRoot 设置

# DocumentRoot "C:/Apache2.2/htdocs"

DocumentRoot "C:/apache-tomcat-6.0.18/webapps"

接着在末尾添加如下内容

<Directory "C:/apache-tomcat-6.0.18/webapps/my">

??? Options Indexes FollowSymLinks

??? AllowOverride None

??? Order allow,deny

??? Allow from all

</Directory>

?

# Load mod_jk module

# Update this path to match your modules location

LoadModule??? jk_module? modules/mod_jk.so

# Declare the module for <IfModule directive> (remove this line on Apache 2.x)

# AddModule???? mod_jk.c

# Where to find workers.properties

# Update this path to match your conf directory location (put workers.properties next to httpd.conf)

JkWorkersFile conf/workers.properties

# Where to put jk shared memory

# Update this path to match your local state directory or logs directory

JkShmFile???? logs/mod_jk.shm

# Where to put jk logs

# Update this path to match your logs directory location (put mod_jk.log next to access_log)

JkLogFile???? logs/mod_jk.log

# Set the jk log level [debug/error/info]

JkLogLevel??? debug

# Select the timestamp log format

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# Send everything for context /examples to worker named worker1 (ajp13)

JkMount? /my/servlet/* worker1

相关的官方说明可以在这里找到。

http://tomcat.apache.org/connectors-doc/generic_howto/quick.html

?

5?????? 配置 tomcat

确认 C:\apache-tomcat-6.0.18\conf\server.xml 配置如下:(默认就是这样一般不需要改动)

??? <!-- Define an AJP 1.3 Connector on port 8009 -->

??? <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

?

6?????? 添加一个 servlet

比如 HelloWorldServlet

确认从这个地址能访问到这个 servlet

http://127.0.0.1:8080/my/HelloWorldServlet

?

7?????? 重启 tomcat

应该看到如下信息:

2009-3-13 20:54:14 org.apache.jk.common.ChannelSocket init

信息 : JK: ajp13 listening on /0.0.0.0:8009

?

8?????? 重启 apache

如果如下地址也能访问。说明 tomcat apache 整合成功

http://127.0.0.1/my/HelloWorldServlet

?

?

?

  • 尚学堂.张志宇.TOMCAT集成APACHE.rar (7.9 KB)
  • 下载次数: 1
发表评论
用户名: 匿名