Quick configuration Apache2.x Tomcat 4.x Linux / Windows
------ Author Zhao Jianqing
When you choose free software like Linux, Apache, Tomcat, etc. is developed. Its related configuration is something that makes many programmers headache, often due to the incomplete document, the version is unnecessary, and the version is not wasteful. Now I integrate Apache2.x Tomcat4.x and load balancing configuration procedures, experience with you ..
First, the test environment:
A, linux
Test operating system: Red Linux 7.2
JDK DOWNLOAD J2SDK-1_4_1_02-Linux-i586.bin.
Apache unix Source: httpd-2.0.45.tar.gz [pgp] [MD5]
Tomcat Tomcat 4.1.24
MOD_JK.SO JAKARTA-TOMCAT-Connectors-JK-1.2.3-src.tar.gz
Additional development kit: (used to generate mod_jk.so)
AutoConf-2.53
AUTOMAKE-1.6.3
LibTool-1.4.2
Go to the corresponding website to these development kits (otherwise you can't generate mod_jk.so):
They do the following three separately:
If it is a TAR format, first solve the / TMP
Use root users to enter the corresponding directory to do the following
./configure
./mke
./make install
B, Win2000
Test operating system: Win2000 Advance Server
JDK Download J2SDK-1_4_1_02-Windows-i586.exe
Apache Apache_2.0.45-Win32-x86-NO_SSL.EXE
Tomcat Tomcat 4.1.24
MOD_JK.DLL MOD_JK_2.0.45.DLL
Second, JDK installation:
A, linux:
1, CP / TMP
2, ./*-linux-i586.bin
B, Win2000
Click to run * .exe
Third, apache installation, setting:
A, linux
1. Establish an HTTPD user, CP corresponding source code to / TMP)
2, unpack (gzip -d httpd-2.0.45.tar.gz tar xvf httpd-.2.0.45.tar)
3, CD / HOME / HTTPD /
4, SU
5, ./configure -prefix = / home / httpd --libexecdir = / home / httpd / lib --enable-module = MOST -ENABLE-MODS-Shared = MOST
--enable-module = so
6, Make
7, Make Install
B, Win2000
Run setup.exe
C, set
1, open the conf / httpd.conf file
Modify Listen 80 # 80 to other unused port 8003
Modify the following line
ServerName Localhost
2, test
Apachectl Configtest
If
Syntax OK
Successful
Fourth, Tomcat installation settings
A, linux:
1, establish Tomcat users
2, TAR open package
B, Win2000
Unlock the package
C, set
Java_home = / usr / local / jdk # change to JDK actual PATH
Catalina_home = / home / tomcatd, running, stop
Run: startup.sh /startup.bat
Stop: shutdown.sh/shutdown.bat
5. Generate mod_jk
A, linux
In the Apache site, there is no two-way dynamic library for mod_jk.so, so there is a bit hand-generated.
Trouble, the following is STEPS that generates mod_jk.so
1. Determine LibTool, AutoConf, Automake correctly installed
2, CP Jakarta-Tomcat-Connectors-JK-1.2.3-src.tar.gz / TMP
3, unpack
4, CD JK / Native
5, ./buildconf.sh
6, ./configure -with-apx = / httpd installation directory / bin / apx -with-java-home = $ {java_home}
7, Make
8, Make Install
9. Generate mod_jk.so in the Apache-2.0 directory
Congratulations, you have successfully generated it, if you don't have a few steps
B, Win2000
Sixth, integration:
A, linux:
1, open /usr/httpd/conf/httpd.conf
Add the following line:
LoadModule JK_Module Lib / Mod_jk.so
JKWorkersFile Conf / Workers.properties
Jklogfile logs / mod_jk.log
JKLoglevel Info
B, Win2000:
1, open httpd.conf
Add the following line:
LoadModule JK_Module LIB / MOD_JK.DLL
JKWorkersFile Conf / Workers.properties
Jklogfile logs / mod_jk.log
JKLoglevel Info
C, set:
Add file workers.properties
#
# workers.properties
PS = /
# List the workers by name
Worker.list = Tomcat1, Tomcat2, Loadbalancer
# ------------------------
#First Tomcat Server
# ------------------------
Worker.tomcat1.port = 11009
Worker.tomcat1.host = localhost
Worker.tomcat1.type = ajp13
Worker.tomcat1.lbFactor = 100
# Second Tomcat Server
# ------------------------
Worker.tomcat2.port = 12009
Worker.tomcat2.host = localhost
Worker.tomcat2.type = ajp13
Worker.tomcat2.lbFactor = 100
Worker.loadbalancer.Type = LB
Worker.loadbalancer.balanced_Workers = Tomcat1, Tomcat2
Note that this file edit is wrong, Apache and Tomcat will fail
It is best to paste the above to a new Worker.properties,
Find {Tomcat_Home} / conf directory
Open Server.xml
1. More near 100 lines
3. Comment out 8080 port
If you have to do load balancing,
Additional
Tomcat Application Server (can be on different machines)
Port, IP is changed to be the same as workers.properties
Seven, test:
A, integrated test:
Run httpd
Apachectl Start
Run Tomcat
Startup.sh
Enter: in IE:
http://1ocalhost: 8003 / index.jsp
If you see a lovely cat!
CONGRATTIITION,
IT's OK!
Note 8003 change to the actual HTTPD port
B, load balancing test:
Newly built two index.jsp.jsp
Tomcat1:
<% = Request.getSession (). getId ()%>
body>
html>
Tomcat2:
<% = Request.getSession (). getId ()%>
body>
html>
Go to see the results yourself:
I wish you good luck !!!!!!!!!!!!!!!!!
Eight, small knot:
The above is the whole process of integration, I hope more people will bent. In the total configuration, the key is MOD_JK.SO and WORKERS.Properties generation and configuration, which suggests that you stick your own configuration files on the Workers.properties behavior If you are experiencing something or need to generate mod_jk.so, you can send mail to
Z95888@yahoo.com.cn, very happy to discuss related applications with you.