Linux under JSP environment: APACHE,TOMCAT Configuration
Last Update:2017-02-28
Source: Internet
Author: User
Apache|js Linux under the JSP development environment, APACHE,TOMCAT server configuration process:
(Special note: This article is referred to the Internet, through personal practice and summary, if you encounter problems in the configuration, please contact me, may write the time missing some places, thank the experience of the Internet predecessors, hope that more practical experience to share)
1. Operating system
RedHat Linux 9.0
2. Required Software
Apache 2.0.54
Download Address
Http://apache.freelamp.com/httpd
Download the file httpd-2.0.54.tar.gz
Tomcat5.5.9
Download Address
http://apache.justdn.org/jakarta/tomcat-5/v5.5.9/bin/
Download the file jakarta-tomcat-5.5.9.tar.gz
MOD_JK 1.2.14
Download Address
http://apache.justdn.org/jakarta/tomcat-connectors/jk/source/jk-1.2.14/
Download the file jakarta-tomcat-connectors-1.2.14-src.tar.gz
JDK 1_5_0_04
Download Address
http://java.sun.com/j2se/1.5.0/download.jsp
Download the file Jdk-1_5_0_04-linux-i586-rpm.bin
Save the required package files in the/usr/local directory when downloading
3. Installation Steps
A Install JDK
# cd/usr/local/
# chmod +x Jdk-1_5_0_04-linux-i586-rpm.bin
#./jdk-1.5.0_04-linux-i586-rpm.bin
# cd/usr/java/
# ln-s/usr/java/jdk-1_5_0_04/usr/local/java
# Vi/etc/profile
#
Add the following content
Java_home=/usr/java/jdk-1_5_0_04
Classpath=/usr/java/jdk-1_5_0_04/lib/dt.jar:/usr/java/jdk-1_5_0_04/lib/tools.jar
Path=/usr/java/jdk-1_5_0_04/bin: $PATH
Export PATH java_home CLASSPATH
B Install Apache
# cd/usr/local/
# tar Xvfz httpd-2.0.54.tar.gz
# CD httpd-2.0.54
#./configure--prefix=/usr/local/apache--enable-module=so
# make
# make Install
# cd/usr/local/apache/conf
# Vi./httpd.conf
Modify Listen 80 to listen 127.0.0.1:80 (219 lines)
Modify ServerName to servername localhost:80 (line 291)
Add index.jsp (394 lines) to DirectoryIndex
# cd/usr/local/apache/bin/
#./apachectl Configtest
Display syntax OK indicates successful installation
#./apachectl start
Start the Apache service, access the native 80 port in the browser, see if the port is normal, enter 127.0.0.1:80
#./apachectl Stop
Turn off services
Note: prefix defines the installation path for Apache
C Install Tomcat
# cd/usr/local/
# tar Xvfz jakarta-tomcat-5.5.9.tar.gz
# ln? s/usr/local/jakarta-tomcat-5.5.9/usr/local/tomcat
# vi/usr/local/tomcat/bin/catalina.sh
Line 46th Add this sentence
Java_home=/usr/java/jdk-1_5_0_04
After the service is started, access native port 8080 to see if the port is normal (input 127.0.0.1:8080)
#/usr/local/tomcat/bin/startup.sh/startup.bat
Turn off services
#/usr/local/tomcat/bin/shutdown.sh/shutdown.bat
D installation JK
# cd/usr/local/
# tar XZVF jakarta-tomcat-connectors-1.2.14-src.tar.gz
# CD Jakarta-tomcat-connectors-1.2.14-src/jk/native
# chmod 755 buildconf.sh
#./buildconf.sh
#./configure--with-apxs=/usr/local/apache/bin/apxs
# make
# make Install
# cd/usr/local/jakarta-tomcat-connectors-jk1.2.14-src/jk/native/apache-2.0/
# CP Mod_jk.so/usr/local/apache/modules/
E System Integration
# vi/usr/local/apache/conf/httpd.conf
At the end of the file, add the following statement
#Load MOD_JK
LoadModule Jk_module modules/mod_jk.so
# Configure MOD_JK
Jkworkersfile conf/workers.properties
Jklogfile Logs/mod_jk.log
Jkloglevel Info
Jkmount/*.jsp LoadBalancer
jkmount/servlet/* LoadBalancer
jkmount/application/* LoadBalancer
#vi/usr/local/apache/conf/workers.properties
Add the following statement
#
# workers.properties
#
# in Unix, we use forward slashes:
ps=/
# list the workers by name
WORKER.LIST=TOMCAT1, TOMCAT2, LoadBalancer
# ------------------------
# The A-Tomcat server
# ------------------------
worker.tomcat1.port=8009
worker.tomcat1.host=127.0.0.1
Worker.tomcat1.type=ajp13
# Specify the size of the open connection cache.
#worker. tomcat1.cachesize
#
# Specifies the load balance factor when used with
# A load balancing worker.
# Note:
#----> Lbfactor must be > 0
#----> Low lbfactor means less work do by the worker.
worker.tomcat1.lbfactor=100
# ------------------------
# Second Tomcat Server
# ------------------------
worker.tomcat2.port=8009
worker.tomcat2.host=192.168.1.34
Worker.tomcat2.type=ajp13
# Specify the size of the open connection cache.
#worker. tomcat2.cachesize
#
# Specifies the load balance factor when used with
# A load balancing worker.
# Note:
#----> Lbfactor must be > 0
#----> Low lbfactor means less work do by the worker.
worker.tomcat2.lbfactor=100
# ------------------------
# Load Balancer Worker
# ------------------------
# The LoadBalancer (type lb) worker performs weighted Round-robin
# load balancing with sticky sessions.
# Note:
#----> If A worker dies, the load balancer'll check its state
# once in a while. Until then all work are redirected to peer
# Worker.
Worker.loadbalancer.type=lb
WORKER.LOADBALANCER.BALANCED_WORKERS=TOMCAT1, TOMCAT2
#
# End Workers.properties
#
#vi/usr/local/tomcat/conf/server.xml
<connector port= "8009"
Protocolhandlerclassname= "Org.apache.jk.server.JkCoyoteHandler"
Redirectport= "8443" protocol= "ajp/1.3"/> Line 101th
Add the following statement (to note) around 119 lines
<engine name= "Standalone" defaulthost= "localhost" jvmroute= "TOMCAT1" ></Engine>
If the second Tomcat, change the Jvmroute to TOMCAT2
System Integration Complete
Start Apache and Tomcat services
#/usr/local/apache/bin/apachectl Start
#/usr/local/tomcat/bin/catalina.sh Start
Add the following to the end of the/etc/rc.d/rc.local file
To open the Apache,tomcat service after the system starts
#vi/etc/rc.d/rc.local
Add to
/usr/local/tomcat/bin/catalina.sh start
/usr/local/apache/bin/apachectl start