These two days in order to set up a JSP environment, refer to the online article, and toss 2 days to get the integration of Apache2 Tomcat4.1, and the following integration summary. If you refer to this article, please contact me with me.
First, software preparation: Suppose you have a hardware and software environment that can run Win2000 Server.
1, J2SDK1.4.1:
To http://java.sun.com/j2se/ download!
(Note is the SDK version of Windows (All Languages, Including English)
2.Apache2.0.47:
To http://archive.apache.org/dist/httpd/binaries/win32/apache_2.0.47-win32- x86-no_ssl.msi download!
3.Tomcat4.1.27
To http://apache.oregonState.edu/jakarta/tomcat-4/binaries/jakarta-tomcat-4.1.27.exe download!
4.MOD_JK.DLL: to http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.4/bin/win32/mod_jk_2.0.46.dll download!
(Instead, since the article on the Internet is used with mod_jk-2.0.43.dll and apache2.0.0.47 configuration is not successful, use mod_jk-2.0.46.dll replacement)
Second, software installation
l Install JDK
No source code and Demo are required. Follow the installation wizard, I choose to install to C: / J2SDK1.4.0_01, set the environment variable of Java HOME
Java_Home = C: /J2SDK1.4.0_01
Add Java_Home and Java_Home / BIN to the system environment variable PATH, my setting is
C: /J2SDK1.4.0_01; C: /J2SDK1.4.0_01/bin
l Install Apache2.0.47
Follow the installation wizard (select the installation directory to D: /, convenient below; the installation is successful, its path is: D: / Apache2) (Fqdn) or set to localhost (this is only suitable for testing, only through local access.
l Install Tomcat 4.1.27
Follow the installation wizard, change the installation directory for the directory you want to install, the directory I installed is d: / tomcat4.1, which will enter the password of Admin (System Administrator).
Set the environment variable of Tomcat Home, add a Catalina Home
Tomcat_home = d: /tomcat4.1
Catalina_home = d: /tomcat4.1
l Installed in MOD_JK.DLL
Copy the downloaded mod_jk-2.0.46.dll Under D: / Apache2/conf/httpd.conf, then add the following segment and save it. # Set the connection between Apache and Tomcat, let Apache encounter JSP files, put it in the background to process it with Tomcat # usnamic calls to TomcatloadModule JK_Module Modules / Mod_jk_2.0.46.dll 3, respectively Apache and Tomcat
l Open d: /apache2/conf/httpd.conf, find AddDefaultcharset ISO-8859-1 changed to #adddefaultcharset ISO-8859-1
AdddefaultCharset GB2312
Open d: /apache2/htdocs/index.html.zh-cn.gb2312 is changed to index.html
After the modification is complete, restart Apache, open the browser to enter http: // localhost (note that you need to stop IIS service). At this point you can see the welcome interface of Apache2 in your browser. Description Apache2 is working properly.
l Start Tomcat, then open the browser, enter: http: // localhost: 8080 test: You can see Tomcat's welcome interface in your browser. Description Tomcat works normally.
Fourth, integrated configuration Apache2 and Tomcat4.1 (via MOD_JK module)
Copy and paste as follows D: /Apache2/conf/httpd.conf
JKWorkersFile "D: /tomcat4.1/conf/Workers.properties"
JKLogfile "D: /TOMCAT4.1/logs/mod_jk2.log"
JKLoglevel Info
# Set the virtual host
ServerAdmin junningli@sohu.com
Document D: /tomcat4.1/webapps/
DirectoryIndex index.html index.htm index.jsp
ServerName Localhost
Errorlog logs / shsc-error_log.txt
Customlog logs / shsc-access_log.txt Common
JKMount / Examples / Servlet / * AJP13
# Let Apache support to transmit to servlets to Tomcat resolution
JKMount /*.jsp Ajp13
# Let Apache support to transfer JSP for Tomcat analysis
Virtualhost>
In d: /tomcat4.1/conf, create a new file workers.properties pay attention to the file suffix, its contents are as follows:
Workers.tomcat_home = d: /tomcat4.1
# Let the mod_jk module know Tomcat
Workers.java_home = c: /j2sdk1.4.0_01
# Let the mod_jk module know J2SDK
PS = /
Worker.list = ajp13
# Module version, existing AJP1, do not modify
Worker.ajp13.port = 8009
# 工 端 端,, do not modify if it is not occupied
Worker.ajp13.host = localhost
# 本机, if the above Apache host is not localhost, make a corresponding modification
Worker.ajp13.type = ajp13
#Types of
Worker.ajp13.lbFactor = 1
# 代理 数, do not have to modify the five, integrated test
l Start Apache2.0.47 and Tomcat4.1.27.
l 2. Enter http://localhost/examples/jsp/index.html in the address bar, with http: // localhost: 8080 / examples / jsp / index.html, congratulations, Apache2.0.47 Integrate with Tomcat4.1.27! ! !
6. Establish your own project
You already have a project in the D: /Tomcat4.1/webapps/test directory, contain index.jsp and other files, pay attention to web.xml under Web-INF, usually the following
Xml Version = "1.0" encoding = "ISO-8859-1"?>
Public "- // Sun microsystems, Inc.//dtd Web Application 2.3 // en"
"http://java.sun.com/dtd/web-app_2_3.dtd">
Tomcat test
description>
web-app>
Set Tomcat to support your project, open the D: / Tomcat 4.1 / conf / server.xml file, add
Restart Tomcat4, open the browser to enter http: // localhost / test / you can see the test page.
Retained 1: Discover the setup error of the servlet, refer to the article below.
Original virtual host configuration
ServerAdmin junningli@sohu.com
Document D: /tomcat4.1/webapps/
DirectoryIndex index.html index.htm index.jsp
ServerName Localhost
Errorlog logs / shsc-error_log.txt
Customlog logs / shsc-access_log.txt Common
JKMOUNT / Servlet / * ajp13
# Let Apache support to transmit to servlets to Tomcat resolution
JKMount /*.jsp Ajp13
# Let Apache support to transfer JSP for Tomcat analysis
Virtualhost>
Correct configuration
ServerAdmin junningli@sohu.com
Document D: /tomcat4.1/webapps/
DirectoryIndex index.html index.htm index.jsp
ServerName Localhost
ERRORLOG logs / shsc-error_log.txtcustomlog logs / shsc-access_log.txt Common
JKMount / Examples / Servlet / * AJP13
# Let Apache support to transmit to servlets to Tomcat resolution
JKMount /*.jsp Ajp13
# Let Apache support to transfer JSP for Tomcat analysis
Virtualhost>
Reference:
http://www.macdevcenter.com/pub/a/mac/2002/08/20mcat_integration.html?page=1
Correction date: 2003.11.3