Win2000XP apache2.0.48 + tomcat5.0.19 + mysql4.0.18 + jdk1.51.4 + JSPservlet integration advanced (1)

zhaozj2021-02-16  43

Software preparation:

J2SDK 1.5 Beta1 http: //java.sun.comapache 2.0.48 http://archive.apache.org/dist/httpd/tomcat 5.0.19 http://archive.apache.org/dist/jakarta/tomcat-5 / Mysql 4.0.18 http://www.mysql.com/downloads/index.htmlmlmlmlmysql control center 0.9.4 http://www.mysql.com/downloads/index.htmlmlmlmlMysql MySQL Connector / J 3.1 http: // www .mysql.com / downloads / index.htmlmod_jk2-2.0.43.dll http://archive.apache.org/dist/jakarta/tomcat-connectors/jk2/

1. J2SDK installation and environment configuration

1.1 Installing J2SDK can be installed in any directory with your own will

1.2 Setting the environment variable (take me as an example)

Right-click on my computer -> Advanced -> New Variable

Variable variable value java_homed: / program files / java / j2sdk1.5.0classpath.;% Java_home% / lib;% java_home% / lib / dt.jar;% java_home% / lib / Tools.jar;% java_home% / jre / lib ;% Java_home% / jre / lib / ext;% java_home% / jre / lib / RT.jar;% Tomcat_Home% / common / lib / mysql-connection-java.jar;% Tomcat_Home% / Common / libpath% java_home; % Java_home% / bintomcat_homec: / tomcat 5.0

Note: The specific value of the variable, please set up according to your own situation, where the mysql-connection-java.jar file and tomcat_home will introduce below.

2. Installation and configuration of Apache 2.0.48

2.1 Apache installation According to the default installation, my installation directory is C: /, after the installation is complete, there will be an Apache2 directory, below I represent this installation directory with $ apache_dir

2.2 Apache configuration

2.2.1 New Workers2.Properties text files in a $ apache_dir / conf directory, the content is as follows

# ------------------------------------------------- -------------- [SHM] # Change file = c: /apache2/logs/shm.file size = 1048576 according to your own installation directory

# Socket Channel [Channel. Socket: Localhost: 8009] Port = 8009Host = 127.0.0.1 # Tomcatid = 127.0.0.1: 8009

# Worker for the connector [AJP13: localhost: 8009] Channel = Channel. Socket: Localhost: 8009

# ------------------------------------------------- -----------------

2.2.2 Modify $ apache_dir / conf / httpd.conf file, open with any text editor

2.2.2.1 Search for "DocumentRoot" keyword, change the original setting to

# ------------------------------------------------- ----------------- Directory set by yourself, D: / WebApps released root directory for my web

DocumentRoot "D: / WebApps"

# ------------------------------------------------- ------------------ 2.2.2.2 Search "Document To" keyword, that is, find a few rows below, and modify it to the web publishing directory, matchless DocumentRoot Also consistent with Tomcat's publishing catalog # ------------------------------------------ -------------------------- # this kind be changing to whatver you set documentroot to. #

2.2.2.3 Search "AddDefaultCharset ISO-8859-1" change

# ------------------------------------------------- -----------------

# Add Chinese Support # AddDefaultCharset ISO-8859-1

AddDefaultcharset GB2312 DefaultLanguage GB2312 AddLanguage EN-CN.CN

# ------------------------------------------------- ---------------- 2.2.2.4

Alias ​​/ servlet / "D: / WebApps / Servlet /"

Options Indexes MultiViews Allowoverride None ORDER ALLOW, DENY Allow from All

# ------------------------------------------------- ----- loadModule JK2_Module Modules / MOD_JK2.DLL

jkuriSet worker ajp13: localhost: 8009

JKuriSet worker ajp13: localhost: 8009 # ----------------------------- -------------------------

Need to pay attention, here is JK2_Module not jk_module, the configuration method of both is different, JK2 is more powerful

The purpose here is to submit the files of the corresponding retrore name of the following position to Tomcat, interpreted by Tomcat, because the efficiency of Apache performs pure HTML files is much higher than Tomcat. In order to improve the performance efficiency, it is recommended to put servlets separately In a directory, only the servlet file is placed. "/ Servlet / *" represents all the files in the servlet directory in the web publishing directory, / *. JSP represents all * .jsp files in the web publishing directory, you can add as needed

----to be continued

Author: Arthurz Email: YEPPO1979@msn.com

转载请注明原文地址:https://www.9cbs.com/read-26163.html

New Post(0)