apache http server jk方式整合tomcat

阅读更多

小配置量整合apache http server 和tomcat

  • 安装http server和tomcat
http://daqiqiu.iteye.com/blog/1867740

 

  • 配置mod_jk.so
    tar -xvf tomcat-connectors-1.2.37-src.tar.gz
    ./configure --with-apxs=//bin/apxs
    执行后mod_jk.so在tomcat-connectors-1.2.37-src/native/apache-2.0目录内。
  • 整合http server 和tomcat

在apache http server的httpd.conf中加入  Include /opt/apache-httpd/conf/mod_jk.conf  用来引入外部conf文件,然后编辑mod_jk.conf,如下:
LoadModule jk_module /opt/apache-httpd/modules/mod_jk.so                    #加在mod_jk模块
JkWorkersFile /opt/apache-httpd/conf/workers.properties                            #指定properties文件位置
JkLogFile /home/website/logs/mod_jk.log                                                     #log文件位置
JkLogLevel info                                                                                            #日志级别
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"                    #日志格式
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories       #
JkRequestLogFormat "%w %V %T"                                            #日志格式
JkMount /servlet/* cata                                                                                  #指定tomcat处理哪些请求,cata对应worker.properties中worker名字
JkMount /*.jsp cata                                                                                        #同上
编辑workers.properties ,如下:
worker.list=cata                       #指定worker名字
worker.cata.type=ajp13           #类型
worker.cata.host=127.0.0.1     #主机
worker.cata.port=8009             #端口
编辑完成后重启http server,访问tomcat处理的url,刚开始出现worker xxx not found in urlmapping 的错误,网上说是copy properites文件时出现非法字符,我的问题是copy过来的conf文件中没有指定work.properties文件位置,添加JkWorkersFile /opt/apache-httpd/conf/workers.properties 后,成功。

 

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