apache integrate tomcat with jk1.2

来源:互联网 发布:java rar 解压 编辑:程序博客网 时间:2024/05/29 18:56
enviroment:
winXp     jakarta-tomcat-5.0.28.exe
jdk1.4.2  apache_2.0.47-win32-x86-no_ssl.msi

1. setup virtual folder for tomcat and apache, then we can visit the links below
   1.1 add the string below to the end of %apache%/conf/httpd.conf
        Alias /integrateTomcat "E:/projects/integrateTomcat/web" 
        <Directory "E:/projects/integrateTomcat/web">         
            Options Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
   1.2 add the string below to the file %tomcat%/conf/Catalina/localhost/integrateTomcat.xml
       <Context path="/integrateTomcat" reloadable="true"  docBase="E:/projects/integrateTomcat/web" >
       </Context>
   1.3 create files below:
       1.3.1 E:/projects/integrateTomcat/web/testTomcat.jsp's content like below:
              hello <%="tomcat"%>
       1.3.2 E:/projects/integrateTomcat/webtestApache.html's content like below:
              hello apache
       1.3.3 E:/projects/integrateTomcat/web/WEB-INF/web.xml
              <?xml version="1.0" encoding="ISO-8859-1"?>
              <!DOCTYPE web-app  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
               <web-app>
                    <display-name>integrate tomcat in apache</display-name>
               </web-app>
       1.3.4  confirm the links below can be visit
            http://localhost:8080/integrateTomcat/testTomcat.jsp    ---->   hello tomcat
            http://localhost/integrateTomcat/Apache.html            ---->   hello apache

2. install and configurate jk1.2 via:
   2.1  download jk1.2 via:
        http://apache.freelamp.com/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.27/
   2.2  rename the file downloaded just now from mod_jk-1.2.27-httpd-2.0.63.so to mod_jk.so
   2.3  move the file mod_jk.so to %apache%/modules
   2.4  make apache load jk1.2
        modify %apache%/conf/httpd.conf
        add string below
             LoadModule jk_module modules/mod_jk.so
             JkWorkersFile "C:/Program Files/Apache Group/Apache2/conf/workers.properties"
             JkLogFile "C:/Program Files/Apache Software Foundation/Tomcat 5.0/logs/jk.log"
             JkLogLevel error
        after the string below
             #LoadModule ssl_module modules/mod_ssl.so
   2.5  edit the file C:/Program Files/Apache Group/Apache2/conf/workers.properties
                workers.tomcat_home="C:/Program Files/Apache Software Foundation/Tomcat 5.0"
                workers.java_home="C:/j2sdk1.4.2_17"
                workers.apache2_home="C:/Program Files/Apache Group/Apache2"
                ps=/
                worker.list=jk_connector
                worker.jk_connector.port=8009
                worker.jk_connector.host=127.0.0.1
                worker.jk_connector.type=ajp13
                worker.jk_connector.socket_timeout=200
   2.6 tell apache redirect which request to the tomcat
       add the string below to the end of the file %apache%/conf/httpd.conf
                JkMount /integrateTomcat/*.jsp  jk_connector
   2.7  restart tomcat, restart apache

3. check the effection
   3.1 stop tomcat and visit the url below successfully
        http://localhost/integrateTomcat/Apache.html
   3.2 start tomcat and visit the url below successfuly
        http://localhost/integrateTomcat/testTomcat.jsp
   3.3 can't visit the link below after stop tomcat
        http://localhost/integrateTomcat/testTomcat.jsp

 


refer to 

http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/v1.2.4/doc/

http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/v1.2.4/doc/jk/aphowto.html

http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/v1.2.4/doc/jk/workershowto.html


some exaple

http://java.ccidnet.com/art/3565/20041013/480465_1.html

http://www.linuxsir.org/bbs/showthread.php?t=236915

http://blog.csdn.net/kfc1003/archive/2008/10/25/3142903.aspx

tc4ntiis.zip:Apache組織Jakarta項目開發的使IIS支持Tomcat的插件.

原创粉丝点击