Configuration process of JSP development environment, Apache and Tomcat server in Linux

Source: Internet
Author: User

In the JSP development environment in Linux, the configuration process of Apache and tomcat servers is as follows:
(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/tomcat-connectors/jk/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
<Connection Port = "8009"
Protocolhandlerclassname = "org. Apache. JK. server. jkcoyotehandler"
Redirectport = "8443" protocol = "AJP/1.3"/> 101st rows

Add the following statement (comment out) to around 119 lines)
<Engine name = "standalone" defaulthost = "localhost" jvmroute = "tomcat1"> </engine>
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.