Tomcat 5.0.27 + apache 2.0.49 + J2SDK 1.4.2 + MOD

xiaoxiao2021-03-06  102

Turning countless articles, finally built on their own machines, sharing it for everyone.

Step 1: Download J2SDK and Tomcat:

To the Sun Official Site (http://java.sun.com/j2se/1.4.2/download.html) Download J2SDK; to Tomcat Official Site (http://www.apache.org/dist/jakarta/tomcat-4 /) Download Tomcat;

Step 2: Install and configure your J2SDK and Tomcat:

Execute the J2SDK and Tomcat installer, and then press the default settings.

1. After installing J2SDK, you need to configure the environment variable, add the following environment variables in my computer-> property -> Advanced -> Environment Variable -> System variable (assuming your J2SDK installed in C: / JDK): java_home = C: / jdk classpath =.;% java_home% / lib / dt.jar;% java_home% / lib / Tools.jar; (.) must not be less, because it represents the current path) Path =% java_home% / bin then Write a simple Java program to test whether J2SDK has been installed successfully: public class test {public static void main (string args []) {system.out.println ("this is a test program");}} will be above This program is saved as a file called Test.java. Then open the command prompt window, cd to your directory where you test.java, and type the following command Javac Test.java Java Test At this time, if you see this is a test program. If you have successful installation, if you don't print This sentence, you need to check your configuration carefully.

2. After installing Tomcat, start Tomcat under start = "Programs =" Tomcat, access http: // localhost: 8080 in IE, if you see Tomcat's welcome page, the installation is successful.

Step 3: Install and configure your apache: http.conf file configuration

1. Set the default Web Directory: DocumentRoot "Default Directory Name" such as DocumentRoot "C: / INETPUB / WWWROOT"

2. Set the web default port: Listen 80 (can be 8080, etc.)

3. Set the default language code: such as: adddefaultcharset GB2312 DefaultLanguage GB2312 AddLANGUAGUAGUAGUAGUAGUAGUAGUAGUAGUAGUAGE GB2312 AddLAGUAGUAGUAGE GB2312 ADDLANGUAGE EN.

4. Set the default page: DirectoryIndex default page file name, DirectoryIndex index.html index.html.var default.jsp Index.jsp.jsp.jsp.jsp.jsp.jsp.jsp.jsp.jsp.jsp.jsp

5. Setup virtual directory: Alias ​​/ VDIR / "C: / comXe /" Options MultiView, Deny Allow from allow, deny allow from all or alias / Soft / "E: / SoftWares / "Alias ​​/ Test /" C: / Test / "basically complete configuration

Step 4: Haha's most critical step A T integration

Description:% apache_home% is the installation directory% catalina_home% of the Apache installation directory not required environmental variables during the entire process of Tomcat installation directory

Suppose Tomcat installation service port is 8080 Apache installation service port is 80

MOD_JK2.SO http://219.217.8.91/jk2.rar

1. Copy MOD_JK2.SO to% apache_home% / modules

2. Confident MOD_JK2.SO readable (for System users, file properties -> security)

3. Create a JK2.Properties file, the specific content of the file is as follows:

# # Socket configuration # handler.list = request, container, channelsocket

# # Socket configuration # channelsocket.port = 8009 channel.address = 127.0.0.1 channel.maxport = Port 10

4. Put this file into% catalina_home% / conf, if this file already exists, let's back up the original JK2.Properties

5. Confident to read this file (for System users)

6. Create a workers2.properties file, the specific content of the file is as follows # #basic workers2.properties file #

# # Shared memory # [shm] file = apache installation path / logs/shm.file # ~~~~~ # Need to change the place, fill in the absolute path of Apache installation, # such as C: / Program files / apache group / apache2 / size = 1048576

[workeenv:] info = global server options Timing = 1 debug = 0

# Inel.socket: localhost: 8009] Port = 8009 Host = 127.0.0.1

# # Define the ajp13 worker # [AJP13: localhost: 8009] channel: localhost: 8009

# # Uri mapping - JSP files Only # The following is the root directory /*.jsp, you can change [URI: / *. Jsp] worker = ajp13: localhost: 8009 # URI mapping - All servlets # can change the servlet [URI : / *] Workers = ajp13: Localhost: 8009

7. Place this file in% apache_home% / confes

8. Confirm this file readable (for System users)

9. Create a shm.file file. Let's take a method to create a shm.file command line to enter% apache_home% / logs, enter Copy Con:> shm.file Enter Multiple Enter some empty rows, then press CTRL z Enter the carriageway.

10. Confident SHM.File in% Apache_Home / logs / directory, confident that Shm.file file can be written

11. Add load mod_jk2.so information in% apache_home% / conf / httpd.conf, you will see a bunch of loadModule's loading module to add the following information here:

LoadModule JK2_Module Modules / MOD_JK2.SO

12. Continue in this file (% apache_home / conf / httpd.conf) to map Tomcat information, which will allow apache to resolve static information (you can find Alias, put the following line in Alias ​​/ Icons / .. .... Before and after, in fact, there is no limit on the specific location, just to make it easy for changes to the future):

Alias ​​/ "Tomcat installation directory / WebApps /" # ~~~~~~~~~~~~~~

#Note:

# Here, fill in the absolute path of Tomcat installation # If you change the path to the application map in the Tomcat Directory / Server.xml, here #, you have to do corresponding changes.

13. Turn off the Apache server

14. Close Tomcat server

15. Restart Tomcat Server

16. Test whether Tomcat is started by browsing http: // localhost: 8080 (http: // Don't omit) If you use Localhost to find it, change it to your IP

17. Start Apache Server

18. Test the link below:

http: // localhost

Open the link on the left of the page Examples -> JSP Examples 19. Compare the link below:

http: // localhost: 8080

Open the links in the left of the page Examples -> JSP Examples 20. Run the examples in several JSP Examples, if the results are the same, indicating that Tomcat and Apache have been integrated together.

IV, thanks to the Apache organization, give me such a good server, but still free!

Fifth, if you feel satisfied with the explanation, or would like to reprint this article collections, I am very grateful, but please indicate the author: Ginkgo suzerain (^ _ ^) MSN: AsiaGodFather@hotmail.com

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

New Post(0)