============================================= I have tested this article and passed it Got it! ============================================= Title: Integration under Windows 2000 Apache2 and Tomcat4 Author: robornet Date: 2002-10-30 Reason: I have been working on a java project for a while, and when it was time to distribute it, I could not find the latest integrated configuration of Apache2 and Tomcat4, so I watched jakarta for a long time. Based on online information and referring to previous netizens’ articles, I wrote this configuration document for reference. Any corrections are welcome! Contents: 1. Software preparation 2. Software installation 3. Initial configuration and testing 4. Integrated configuration 5. Full line test 6. Deficiencies 7. Thank you 8. Explanation steps: 1. Software preparation: Suppose you have a hard drive that can run win2000 normally. Soft software environment. 1.j2sdk1.4.1: Go to http://java.sun.com/j2se/1.4.1/download.html to download! (Note that it is the sdk version of Windows (all languages, including English)) 2.Apache2.0.43: Go to http://www.apache.inetcosmos.org/dist/httpd/binaries/win32/apache_2.0.43-win32-x86- no_ssl.msi Download! 3.Tomcat4.1.12: Go to http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/bin/jakarta-tomcat-4.1.12.exe to download! 4.mod_jk.dll: Go to http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.0/bin/win32/mod_jk-2.0.42.dll to download! (Explanation, since the configuration of mod_jk2-2.0.43.dll and Apache2.0.43 was not successful, mod_jk-2.0.42.dll is used instead) 2. Software installation: (1) Install j2sdk: 1. Follow the installation wizard to install (generally Install to C:j2sdk1.4.1 to facilitate the following operations) (2) Install apache: 1. Follow the installation wizard to install (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 (change the installation directory to C: Tomcat4, if it is just for testing, there is no need to install tomcat as Services to facilitate the following operations), during which you will be asked to enter Admin (system administrator) Password. 3. First-time configuration and testing: Configure the software environment installed above for the first time and test its environment. (1) Configuration--Environment variables: 1. Create a new system variable JAVA_HOME, its value is: C:j2sdk1.4.1 //If you did not install according to the above path, please change it to the correct path 2. Create a new system variable TOMCAT_HOME, its value is: :C:Tomcat4 //Same as above 3. Create a new system variable CLASSPATH, its value is: %JAVA_HOME%lib;%TOMCAT_HOME%lib (2) Modify the error: 1.Apache2.0.43 has a small problem. After the default installation is successful, it will be installed on the Apache2 main There is no index.html file in the htdocs directory. You must rename index.html.en in this directory to index.html (3) Test the default service: Please run Apache2 and Tomcat4 first. 1. Open the browser and click on Enter: http://localhost in the address bar. Verification: At this time, you can see the welcome interface of Apache2 in the browser. It means that Apache2 is working normally. (Note that the default port of Tomcat is 80. If it is occupied by other programs, please change it, as follows There are instructions) 2. Open the browser and enter: http://localhost:8080 in the address bar. Verification: You can see Tomcat’s welcome interface in the browser at this time. It means that Tomcat is working normally. (Note that the default port of Tomcat is 8080. If it is occupied by other programs, please change it. There are instructions below) Summary: If there are no errors at this step, you can continue with the following operations. Let go! (4) Test your project: Now only use Tomcat to test your project Project, for the convenience of this example, assume that you already have a project in the E:ApplicationOA directory (including index.jsp and other jsp files and beans, such as servlets and javabeans under WEB-INFclasses). 1. Set up Tomcat to support your project, open the C:Tomcat4confserver.xml file, add before "" and after "" and save it. Description: Context (representing a web application): docBase defines the path of the application; path represents the prefix of the URL of this web application, so that the requested URL is http://localhost:8080/oa; reloadable This attribute is very important. If it is true, tomcat will automatically detect changes in the application's /WEB-INF/lib and /WEB-INF/classes directories, automatically load modified or new beans and servlets, and we can view them without restarting tomcat. To the changes brought to jsp by beans. 2. Start your Tomcat 4.1.12 and enter http://localhost:8080/oa in the browser address. If there are no errors in your jsp, beans, and servlets, your index.jsp/index.html file will generally be The content is executed and displayed. Summary: If there are no errors at this step, you can continue with the following operations, Let go! 4. Integrated configuration: Configure Apache and Tomcat accordingly and let them work together for you. If Apache2 and Tomcat4 are running, please close them. (1) Configure Apache2: 1. First copy the downloaded mod_jk-2.0.42.dll to C:Apache2modules. 2. Set the homepage file type: Open httpd.conf under C: Apache2conf, search for "DirectoryIndex", add index.jsp after index.html and save it. Note that there should be spaces between each other. 3. Set up a virtual host and let Apache automatically control the parsing of html and jsp: Open C: Apache2confhttpd.conf, add the following code at the end and save it. //localhost is the local machine, you can use the local ip ServerAdmin robornet@robornet.com //Your email address DocumentRoot E:Application //Your project group root directory, because there are OA and other projects under Application , so it can only be set to E:Application ServerName localhost //Your service name, if your machine has a domain name, set it to the domain name, but now use this machine for testing ErrorLog logs/robornet_home_log.txt //Error log, in C: Under Apache2logs, you can use any other name CustomLog logs/robornet_Custom_log.txt common //Access log, under C: Apache2logs, you can use any other name 4. Set up the connection between Apache and Tomcat so that when Apache encounters a jsp file , hand it over to Tomcat for processing in the background: open C: Apache2confhttpd.conf, add the following code at the end and save it. # Using mod_jk2.dll to redirect dynamic calls to Tomcat LoadModule jk_module modules/mod_jk-2.0.42.dll //Loading module, used to handle connection JkWorkersFile "C:/Tomcat4/conf/workers.properties" //Setting up the module file, the following will explain JkLogFile "C:/Tomcat4/logs/mod_jk2.log" //Set the log file for module work. Tocmat will build its own JkMount /servlet/* ajp13 when it starts. //Let Apache support servlet transmission for Tomcat parsing JkMount /*.jsp ajp13 //Let Apache support jsp transmission for Tomcat parsing Summary: At this point, the configuration of Apache is basically completed, but starting Apache at this time does not work properly. (2) Configure Tomcat4: 1. Create a new file workers.properties under C:Tomcat4conf. Pay attention to the file suffix. It is recommended to use EditPlus or UltraEdit to create it. If you use Notepad, remember to change the name so that it does not become workers.properties.txt! Its content As follows: workers.tomcat_home=c:Tomcat4 //Let the mod_jk module know Tomcat workers.java_home=c:j2sdk1.4.1 //Let the mod_jk module know j2sdk ps= worker.list=ajp13 //Module version, the existing ajp14 is not required Modify worker.ajp13.port=8009 //Working port, if it is not occupied, there is no need to modify worker.ajp13.host=localhost //This machine, if the Apache host above is not localhost, modify worker.ajp13.type=ajp13 accordingly. //Type worker.ajp13.lbfactor=1 //Number of agents, no need to modify 2. Open the server.xml file under C:Tomcat4conf: Find "" and change the previous code: Change to: Save and close. Summary: Brothers must be tired! Okay, you can have a drink java, enjoy your results! 5. Full test: 1. Start Apache2, 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 http://localhost:8080/oa, congratulations, the integration of Apache2 and Tomcat4 is successful! ! ! 6. Shortcomings: 1. Although I use the latest Apache2.0.43 and Tomcat4.1.12, I use jk to connect. The configuration with jk2 was not successful, so I had to write this document! 2. Tomcat still uses Tomcat-Standalone, not Tomcat-Apache, but you can do this yourself, and this should not be a problem! 7. Thanks: 1. Thanks to the Apache organization for providing me with such a good server, and it’s free! 2. Thanks to friends who have written Apache1.x and Tomcat3.x/Tomcat4.* configuration documents before, for providing me with a reference for writing this document today! 8. Description: 1. If you are satisfied and want to reprint or collect this article, I would like to thank you very much, but please indicate the author robornet and the source http://www.xtong.com.cn/rob
http://www.bkjia.com/PHPjc/531776.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531776.htmlTechArticle======================== ===================== I have passed the test of this article! ============================================= Title: Integration under Windows 2000 Apache2 and Tomcat4 Author:...