Integration of Apache and tomcat
Author: Jing Xiang
Environment:
Windows2003
Jdk1.5
Apache 2.0.53
Tomcat 5.5.9
Related Software:
Apache 2.0.53 :
Http://archive.apache.org/dist/httpd/binaries/win32/
Tomcat 5.5.9 :
Http://archive.apache.org/dist/jakarta/tomcat-5/v5.5.9/bin/jakarta-tomcat-5.5.9.zip
Jdk1.5:
Http://java.sun.com/j2se/1.5.0/download.jsp
Mod_jk- 1.2.12 -Apache-2.0.54.so:
Http://www.apache.org/dist/jakarta/tomcat-connectors/jk/binaries/win32/jk-1.2.12/mod_jk-1.2.12-apache-2.0.54.so
Steps,
Foreplay: first create a folder test under D:/Java/tomcat/webapps.
Put a jspand HTML file in it and call it index.jspand test.html :)
First, set mod_jk- 1.2.12 Apache-2.0.54.so
Put it under the Apache/modules folder.
Create the workers. properties file in the Apache/conf folder.
The content is as follows:
# Modify the current directory according to the installation directory
Workers. tomcat_home = D:/Java/tomcat
Workers. java_home = C:/jdk1.5
PS =/
# Worker. List = ajp13
Worker. List = ajp12, ajp13
Worker. ajp12.port = 8007
Worker. ajp12.host = localhost
Worker. ajp12.type = ajp12
Worker. ajp12.lbfactor = 1
Worker. ajp13.port = 8009
Worker. ajp13.host = localhost
Worker. ajp13.type = ajp13
Worker. ajp13.lbfactor = 1
Worker. loadbalancer. type = LB
Worker. loadbalancer. balanced_workers = ajp12,
Ajp13
Worker. inprocess. type = JNI
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (PS) Classes
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (PS) Lib $ (PS) JAXP. Jar
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (PS) Lib $ (PS) parser. Jar
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (PS) Common $ (PS) Lib $ (PS) Jasper. Jar
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (PS) Common $ (PS) Lib $ (PS) servlet. Jar
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (PS) Common $ (PS) Lib $ (PS) webserver. Jar
Worker. inprocess. class_path = $ (workers. java_home) $ (PS) Lib $ (PS) Tools. Jar
Worker. inprocess. Worker _line =-config
Worker. inprocess. Worker _line = $ (workers. Worker at_home)/CONF/jni_server.xml
Worker. inprocess. Worker _line =-home
Worker. inprocess. Worker _line = $ (workers. Worker at_home)
Worker. inprocess. jvm_lib = $ (workers. java_home) $ (PS) JRE $ (PS) Bin $ (PS) Classic $ (PS) JVM. dll
Worker. inprocess. stdout = $ (workers. tomcat_home) $ (PS) inprocess. stdout
Worker. inprocess. stderr = $ (workers. tomcat_home) $ (PS) inprocess. stderr
Worker. inprocess. sysprops = tomcat. Home =$ (workers. tomcat_home)
Edit httpd. conf in the Apache/conf folder
Add the following fields:
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Loadmodule jk_module modules/mod_jk- 1.2.12 Apache-2.0.54.so
# Prohibit access to the web_inf and meta_inf directories.
<Directory ~ /WEB-INF/>
Order allow, deny
Deny from all
</Directory>
<Directory ~ /META-INF/>
Order allow, deny
Deny from all
</Directory>
# Add a ing so that you can use http: // localhost/test/to access
Alias/test/"D:/Java/tomcat/webapps/test /"
<Directory "D:/Java/tomcat/webapps/test/">
Options indexes Multiviews
AllowOverride none
Order allow, deny
Allow from all
Directoryindex index. jsp
</Directory>
# Add a ing so that you can use http: // localhost/test for access. Note that/
Alias/test "D:/Java/tomcat/webapps/test /"
<Directory "D:/Java/tomcat/webapps/test/">
Options indexes Multiviews
AllowOverride none
Order allow, deny
Allow from all
Directoryindex index. jsp
</Directory>
# Load the configuration file
Jkworkersfile
"D:/Java/XAMPP/Apache/CONF/workers. properties"
# URL rule matching
Jkmount/test/ajp13
Jkmount/test/servlet/* ajp13
Jkmount/test/*. jsp ajp13
Jkmount/test/*. Do ajp13
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
View server. xml under tomcat/CONF/
Add the following fields. If yes, you do not need to add them or add comments. Remove them.
<Connection Port = "8009"
Enablelookups = "false"
Redirectport = "8443" protocol = "AJP/1.3"
Uriencoding = "GBK"/>
Start Tomcat and Apache.
Access
Http: // localhost. The Apache welcome page is displayed.
Http: // localhost: 8080. The Tomcat welcome page is displayed.
Http: // localhost: 8080/waityou. The index. jsp page is displayed. Remove: 8080. Normal.
Http: // lcaolhost: 8080/waityou/test.html. The page test.html is displayed, and the page 8080 is removed.
Reading materials:
Http://community.csdn.net/Expert/topic/3902/3902301.xml? Temp =. 441662.
Http://jakarta.apache.org/tomcat/connectors-doc/
Tomcat authoritative guide in English
Thank you: pigo. I am enthusiastic about explaining and tutoring on QQ. Removed many of my questions. It taught me a lot.