Jsp environment in Linux: apache and tomcat configuration
Last Update:2017-09-26
Source: Internet
Author: User
Jsp environment in Linux: apache, tomcat configuration-Linux Enterprise Application-Linux server application information. For details, refer to the following section. (Note: The content of this article is based on the Internet and summarized through personal practice. If you encounter any problems in the configuration, please contact me. Some parts may be missing during the writing. Thank you for your experience on the Internet, hope more practical experience can be shared)
1. Operating System
RedHat in Linux 9.0
2. Required Software
Apache 2.0.54
Http://apache.freelamp.com/httpd
Download the file httpd-2.0.54.tar.gz
Tomcat5.5.9
Http://apache.justdn.org/jakarta/tomcat-5/v5.5.9/bin/
Download this file jakarta-tomcat-5.5.9.tar.gz
Mod_jk 1.2.14
Http://apache.justdn.org/jakarta .. k/source/jk-1.2.14/
Download the file jakarta-tomcat-connectors-1.2.14-src.tar.gz
Jdk rj5_0_04
Http://java.sun.com/j2se/1.5.0/download.jsp
Download this file jdk-1_5_0_04-linux-i586-rpm.bin
Save the required package file to the/usr/local directory during download.
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/The 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
Change Listen 80 to Listen 127.0.0.1: 80 (row 219)
Change ServerName to ServerName LocalHost: 80 (row 291)
Add index. jsp (row 394) to DirectoryIndex)
# Cd/usr/local/apache/bin/
#./Apachectl configtest
If Syntax OK is displayed, the installation is successful.
#./Apachectl start
Start the apache service and access port 80 of the local machine in the browser to check whether the port is normal. enter 127.0.0.1: 80
#./Apachectl stop
Close service
Note: prefix defines the installation path of 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
Add this sentence to row 3
JAVA_HOME =/usr/java/jdk-1_5_0_04
After the service is started, access port 8080 of the Local Machine to check whether the port is normal (enter 127.0.0.1: 8080)
#/Usr/local/tomcat/bin/startup. sh/startup. bat
Close service
#/Usr/local/tomcat/bin/shutdown. sh/shutdown. bat
D. Install 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
Add the following statement at the end of the file
# 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 statements
#
# Workers. properties
#
# In Unix, we use forward slashes:
Ps =/
# List the workers by name
Worker. list = worker at1, tomcat2, loadbalancer
#------------------------
# First 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
# A load balancing worker.
# Note:
# ----> Lbfactor must be> 0
# ----> Low lbfactor means less work done 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
# A load balancing worker.
# Note:
# ----> Lbfactor must be> 0
# ----> Low lbfactor means less work done by the worker.
Worker. Maid = 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 will check its state
# Once in a while. Until then all work is redirected to peer
# Worker.
Worker. loadbalancer. type = lb
Worker. loadbalancer. balanced_workers = worker at1, tomcat2
#
# END workers. properties
#
# Vi/usr/local/tomcat/conf/server. xml
ProtocolHandlerClassName = "org. apache. jk. server. JkCoyoteHandler"
RedirectPort = "8443" protocol = "AJP/1.3"/> 101st rows
Add the following statement (comment out) to around 119 lines)
If the second tomcat server is deployed, change jvmRoute to tomcat 2.
System integration completed
Start apache and tomcat services
#/Usr/local/apache/bin/apachectl start
#/Usr/local/tomcat/bin/catalina. sh start
Add the following content to the end of the/etc/rc. d/rc. local file.
Enable the apache and tomcat services after the system starts.
# Vi/etc/rc. d/rc. local
Add
/Usr/local/tomcat/bin/catalina. sh start
/Usr/local/apache/bin/apachectl start