Linux(Redhat as4)Apache2整合Tomcat6的实践

注:目录配置



<Host name="localhost"nbsp; appBase="/home/www"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false"gt;

    appBase="/home/www"





DocumentRoot "/home/www/ROOT"





#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/home/www/ROOT"gt;

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
    Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None

#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all

</Directory>



内测后发现公司的平台应用存在不少问题,出于性能以及低成本的负载升级的考虑,决定把平台应用部署到Apache2+Tomcat6整合到环境下。

(5555555555,快写完的时候没有保存,信息全丢了,只好重写.......................................)

准备工作:Apache2 Tomcat6 mod_jk-1.2.26-httpd-2.2.6.so(连接器),Apache官方网站均提供下载。

安装Apache2

1.解压缩安装文件httpd-2.2.9.tar.gz

2.设置安装参数./configure prefix=/usr/local/apache2 --enable-mods-shared=most --enable-so --enable-rewrite --enable-expires --enable-headers --with-mpm=prefork

×prefix=/usr/local/apache2安装路径

×enable-mods-shared=most --enable-so so方式

×--with-mpm=prefork 工作方式

3.执行 make install

4.拷贝mod_jk-1.2.26-httpd-2.2.6.so到modules目录下

5.在conf目录下创建workers.properties以及mod_jk.conf

workers.properties:

workers.tomcat_home="/opt/Tomcat6"nbsp;nbsp;nbsp;
workers.java_home="/usr/java/jdk1.5.0_12"
worker.list=tomcat601,jkstatus #在工作列表里的名字是tomcat601
worker.tomcat601.port=8009 #ajp13使用的port是7009
worker.tomcat601.host=localhost #ajp13的主机是本地
worker.tomcat601.type=ajp13 #ajp13的类型是ajp13 (ajp13是一种连接方式)
worker.tomcat601.lbfactor=1 # 平衡负载
worker.jkstatus.type=status

mod_jk.conf:

LoadModule jk_module modules/mod_jk-1.2.26-httpd-2.2.6.so
JkWorkersFile conf/workers.properties
JkOptions      +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat      "%w %V %T"
JkLogFile  logs/mod_jk.log
JkLogLevel debug
JkMount   /*/servlet/* tomcat601
JkMount   /*.jsp tomcat601
JkMount   /*.do tomcat601
JkMount   /*.vm tomcat601
JkMount  /jkstatus.jsp  jkstatus

6.修改httpd.conf

最后面增加

# mod_jk conf Added by Roade On 2008-08-20
Include conf/mod_jk.conf

修改Document Root为程序的应用根目录

完成以上步骤从其apache,应该可以正常工作。

可以访问 http://IP地址/jkstatus.jsp查看工作情况

你可能感兴趣的:(apache,tomcat,linux,jsp,redhat)