[Jsp + php] Integration of Apache2 and Tomcat4 in Windows2000

Source: Internet
Author: User
I have passed the test in this article! Title: integration of Apache2 and Tomcat4 in Windows author: robornet date: 2002-10-30 reason: After a java project has been running for a period of time, you cannot find a copy of the most Windows2000ApacheTomcat

========================================================== =====
I have passed the test in this article!
========================================================== =====
Question: integration of Apache2 and Tomcat4 in Windows2000

By robornet

Date: 2002-10-30

Reason: After a java project has been running for a period of time, the latest integrated configuration of Apache2 and Tomcat4 cannot be found at the time of delivery. then I read the online data of jakarta for half a day, refer to previous articles by netizens,

I wrote this configuration document for your reference. thank you!

Directory:

I. software preparation

II. software installation

III. initial configuration and testing

IV. integrated configuration

V. full-line testing

VI. deficiency

7. thanks

8. description



Steps:



I. software preparation:

Suppose you have a hard software environment that runs win2000 normally.

1. j2sdk1.4.1: Download to http://java.sun.com/j2se/1.4.1/download.html! (Note: Windows (all languages ages, including English) sdk version)

2. Apache2.0.43: Download to http://www.apache.inetcosmos.org/dist/httpd/binaries/win32/apache_2.0.43-win32-x86-no_ssl.msi!

3. Tomcat4.1.12: Download to http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/bin/jakarta-tomcat-4.1.12.exe!

4. mod_jk.dll: To Release!

(Note, because the mod_jk2-2.0.43.dll and Apache2.0.43 configuration was not successful, now use mod_jk-2.0.42.dll instead)



II. software installation:

(1) install j2sdk:

1. follow the installation wizard to install the SDK. (generally, install it in C: \ j2sdk1.4.1 to facilitate the following operations)

(2) install apache:

1. follow the installation wizard for installation (select the installation directory as C: \ to facilitate the following operations; after the installation is successful, the path is C: \ Apache2)

(3) install Tomcat:

1. follow the installation wizard to install tomcat (change the installation directory to C: \ Tomcat4. if it is only a test, you do not need to install tomcat into Services for the convenience of the following operations ),

In this case, you will need to enter the Admin password.



III. initial configuration and testing:

Configure the software environment for the first time and test the environment.

(1) configuration-environment variables:

1. create a new system variable JAVA_HOME with the value: C: \ j2sdk1.4.1 // If you have not installed it in the preceding path, change it to the correct path.

2. create a new system variable atat_home with the value C: \ Tomcat4 // same as above

3. create a new system variable CLASSPATH with the value % JAVA_HOME % \ lib; % atat_home % \ lib

(2) modification error:

Bytes

(3) test the default service:

Run Apache2 and Tomcat4.

1. open your browser and enter http: // localhost check in the address bar. the welcome page of Apache2 is displayed in the browser. it indicates that Apache2 is working normally. (Note: The default Tomcat port is 80,

If other programs are in use, change them as described below)

2. open your browser and enter http: // localhost: 8080 in the address bar to check whether the Tomcat welcome page is displayed in the browser. it indicates that Tomcat works normally. (Note: The default Tomcat port is

8080. if other programs are in use, change them as described below)

Summary: If there are no errors in this step, continue with the following operations, Let 'Go!

(4) test your project:

Now we only use Tomcat to test your project. for the convenience of this example, assume that you already have a project under the E: \ Application \ OA directory.

(Contains index. jsp and other jsp files and beans, such as WEB-INF \ classes \ servlet, javabean ).

1. set Tomcat to support your project, open the C: \ Tomcat4 \ conf \ server. xml file, in""Before ,""Add later

And save.

Description: Context (indicating a web application): docBase defines the path of the application; path indicates the prefix of the url of the web application. the request url is http: // localhost: 8080/oa;

Reloadable this property is very important, if it is true, tomcat will automatically detect changes to the application's/WEB-INF/lib and/WEB-INF/classes Directory, automatically load modifications or new beans

And servlet. we can see the changes that bean brings to jsp without restarting tomcat.

2. start Tomcat4.1.12 and enter http: // localhost: 8080/oa in the address of the browser. for example, if your jsp and bean are correct, the servlet will normally include your index. jsp/index.html file

Content for execution and display.

Summary: If there are no errors in this step, continue with the following operations, Let 'Go!



IV. integrated configuration:

Configure Apache and Tomcat to work for you.

If Apache2 and Tomcat4 are running, disable them.

(1) configure Apache2:

1. copy the downloaded mod_jk-2.0.42.dll to C: \ Apache2 \ modules first.

2. set the home page file type: open httpd. conf under C: \ Apache2 \ conf and find "DirectoryIndex". Add index. jsp to index.html and save the file. Note that there should be spaces between them.

3. set the VM so that Apache can automatically control html and jsp parsing: Open C: \ Apache2 \ conf \ httpd. conf, add the following code and save it.

// Localhost is the local machine. you can use the local ip address.

ServerAdmin robornet@robornet.com // your mail address

DocumentRoot E: \ Application // root directory of your project team. because there are OA and multiple other projects under the Application, you can only set it to E: \ Application

ServerName localhost // your service name. if your machine has a domain name, it is set as a domain name, but now it is used for testing.

ErrorLog logs/robornet_home_log.txt // error log, which can be any other name in C: \ Apache2 \ logs

CustomLog logs/robornet_Custom_log.txt common // access log, which can be named by any other name under C: \ Apache2 \ logs



4. set the connection between Apache and Tomcat. When Apache encounters a jsp file, it is handed over to Tomcat in the background for processing: Open C: \ Apache2 \ conf \ httpd. conf, add the following code and save it.

# Using mod_jk2.dll to redirect dynamic callto Tomcat

LoadModule jk_module modules/mod_jk-2.0.42.dll // load module for handling connections

JkWorkersFile "C:/Tomcat4/conf/workers. properties" // Set the module's working file, which will be described below

JkLogFile "C:/Tomcat4/logs/mod_jk2.log" // Set the log file used by the module. it will be self-built when Tocmat is started.

JkMount/servlet/* ajp13 // Apache supports servlet transfer for Tomcat parsing

JkMount/*. jsp ajp13 // Apache supports jsp transmission for Tomcat parsing

Summary: the configuration of Apache is basically complete, but it cannot work until Apache is started.

(2) configure Tomcat 4:

1. create a new file workers. properties under C: \ Tomcat4 \ conf and pay attention to the file suffix. we recommend that you use EditPlus or UltraEdit to create the file. if you use notepad, remember to change the name,

No more workers.properties.txt! The content is as follows:

Workers. tomcat_home = c: \ Tomcat4 // let the mod_jk module know about Tomcat

Workers. java_home = c: \ j2sdk1.4.1 // let the mod_jk module know about j2sdk

Ps = \

Worker. list = ajp13 // module version. The current version is ajp14. do not modify it.

Worker. ajp13.port = 8009 // working port. do not modify it if it is not occupied

Worker. ajp13.host = localhost // the local machine. if the above Apache host is not localhost, modify it accordingly.

Worker. ajp13.type = ajp13 // type

Worker. ajp13.lbfactor = 1 // number of proxies, no need to modify

2. open the server. xml file under C: \ Tomcat4 \ conf: Find" ", Convert the previous code:




MinProcessors = "5" maxProcessors = "75" enableLookups = "true" redirectPort = "8443"

AcceptCount = "10" debug = "0" connectionTimeout = "20000" useURIValidationHack = "false"

ProtocolHandlerClassName = "org. apache. jk. server. JkCoyoteHandler"/>





Changed:








MaxProcessors = "75" acceptCount = "10" debug = "0"/>

Save and close.

Conclusion: you must be tired! Well, you can have a cup of java to enjoy your achievements!



5. full-line testing:

1. start Apache2 and Tomcat4.

2. open your browser and enter http: // localhost: 8080/oa in the address bar. if it is the same as the above test, Tomcat will be normal after reconfiguration!

3. enter http: // localhost/oa in the address bar. if the result is the same as that of http: // localhost: 8080/oa, congratulations! Apache2 and Tomcat4 have been integrated successfully !!!



VI. deficiency:

1. although the latest Apache2.0.43 and Tomcat4.1.12 are used, I am using jk connection. I just wrote this document because jk2 configuration was not successful!

2. Tomcat is still using Tomcat-Standalone, but Tomcat-Apache is not used, but you can do it yourself. This should not be a problem!



7. thanks:

1. thanks to the Apache organization for providing me with such a good server, and it is still free!

2. I would like to thank my friends who have previously written the Apache1.x and Tomcat3.x/Tomcat4. * configuration documents for reference!



8. description:

1. if you feel satisfied, I would like to repost or add this article, thank you very much, but please indicate the author robornet and the source http://www.xtong.com.cn/robornet.

2. This article has been adopted by SCID, see: http://developer.ccidnet.com/pub/disp/Article? ColumnID = 322 & articleID = 30015 & pageNO = 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.