RedHatAS5整合Apache和Tomcat应用

日期:2008-06-17  作者:喜腾小二  来源:PHPChina


  AS5下自带了Tomcat5,这个非常方便,建议大家将RPM包全部cp下来,然后用YUM安装,这个不是本文讨论的重点.在AS5下安装Tomcat非常方便,Apache采用RPM包安装.

  1.下载mod_jk

  目前mod_jk连接器稳定版本是1.2.23,使用Web浏览器访问http://www.apache.org/dist/tomca ... es/linux/jk-1.2.23/,下载mod_jk-1.2.23-apache-2.2.x-linux-i686.so.

  2.安装和配置mod_jk

  mv mod_jk-1.2.23-apache-2.2.x-linux i686.so /etc/httpd/modules/mod_jk.so

  在/usr/share/tomcat5/conf目录中新建子目录jk,并新建文works.properties.内容如下:


workers.tomcat_home=/usr/share/tomcat5 workers.java_home=/us/lib/jvm/java ps=/ worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=127.0.0.1 worker.ajp13.type=ajp13 worker.ajp13.lbfactor=1 vi /usr/share/tomcat5/conf/server.xml,在语句下添加

  重新启动tomcat5

  cp /usr/share/tomcat5/conf/auto/mod_jk.conf /usr/share/tomcat5/conf/jk

  mv /usr/share/tomcat5/conf/jk/mod_jk.conf /usr/share/tomcat5/conf/jk/mod_jk.conf-auto

  vi /usr/share/tomcat5/conf/mod_jk.conf-auto,将此文件内容更改如下:

  loadModules jk_module "/etc/httpd/modules/mod_jk.so"

  JkWorkersFile "/usr/share/tomcat5/conf/jk/workers.properties"

  JkLogFile "/usr/share/tomcat5/logs/mod_jk.log"

  JkLogLevel emerg

  ServerNmae localhost

  JkMount /*.jsp ajp13

  3.配置Tomcat vi /usr/share/tomcat5/conf/server.xml

  在xmlValidation="false" xmlNamespaceAware="false">在其后添加以下语句:

  4.配置Apache vi /etc/httpd/conf/httpd.conf

  在最后一行添加如下语句:

  Include /usr/share/tomcat5/conf/jk/mod_jk.conf-auto

  5.重新启动Apache服务和Tomcat服务.

  6.测试Apache和Tomcat整合

  vi /var/www/html/test.jsp

  Hello!The time is

<<<返回技术中心

技术文章

站内新闻

我要啦免费统计