Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configuration of Apache and Tomcat in Jsp Environment of Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly talks about "the configuration of Apache and Tomcat in the Jsp environment of Linux system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "the configuration of Apache and Tomcat under the Jsp environment of Linux system".

1. Operating system

RedHat Linux 9.0

two。 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

An 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

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)

Change ServerName to ServerName LocalHost:80 (291 lines)

Add index.jsp to DirectoryIndex (line 394)

# cd / usr/local/apache/bin/

#. / apachectl configtest

The display of Syntax ok indicates that the installation is successful

#. / apachectl start

Start the apache service and access port 80 in the browser to see if the port is normal. Enter 127.0.0.1pur80.

#. / apachectl stop

Shut down the 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 line 46

JAVA_HOME=/usr/java/jdk-1_5_0_04

After starting the service, access port 8080 of the local machine to see if the port is normal (enter 127.0.0.1 virtual 8080)

# / usr/local/tomcat/bin/startup.sh / startup.bat

Shut down the 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 to 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 statement

#

# workers.properties

#

# In Unix, we use forward slashes:

Ps=/

# list the workers by name

Worker.list=tomcat1, 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 with

# 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 with

# a load balancing worker.

# Note:

#-> lbfactor must be > 0

#-> Low lbfactor means less work done 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 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=tomcat1, tomcat2

#

# END workers.properties

#

# vi / usr/local/tomcat/conf/server.xml

ProtocolHandlerClassName= "org.apache.jk.server.JkCoyoteHandler"

RedirectPort= "8443" protocol= "AJP/1.3" / > Line 101

Add the following statement around line 119 (uncomment)

If the second tomcat, change the jvmRoute to tomcat2

System integration completed

Start the 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

So that the apache,tomcat service can be started after the system is started.

# vi / etc/rc.d/rc.local

Add

/ usr/local/tomcat/bin/catalina.sh start

/ usr/local/apache/bin/apachectl start

At this point, I believe you have a deeper understanding of "the configuration of Apache and Tomcat under the Jsp environment of Linux system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report