位置: 编程技术 - 正文
推荐整理分享Linux系统Jsp的环境:Apache,Tomcat配置(jsp环境变量配置的步骤),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:jsp linux,jsp的环境搭建,jsp环境变量配置的步骤,jsp环境变量配置的步骤,jsp运行环境的配置,请写出jsp环境搭建和配置的步骤,jsp环境变量配置的步骤,jsp linux,内容如对您有帮助,希望把文章链接给更多的朋友!
1.操作系统
RedHat Linux 9.0
2.所需软件
Apache 2.0.
下载地址
下载该文件httpd-2.0..tar.gz
Tomcat5.5.9
下载地址
下载该文件jakarta-tomcat-5.5.9.tar.gz
Mod_jk 1.2.
下载地址
下载该文件jakarta-tomcat-connectors-1.2.-src.tar.gz
Jdk 1_5_0_
下载地址
下载该文件jdk-1_5_0_-linux-i-rpm.bin
下载时将所需软件包文件保存在/usr/local目录下
3.安装步骤
A 安装JDK
# cd /usr/local/
# chmod +x jdk-1_5_0_-linux-i-rpm.bin
# ./jdk-1.5.0_-linux-i-rpm.bin
# cd /usr/java/
# ln -s /usr/java/jdk-1_5_0_ /usr/local/java
# vi /etc/profile
#
添加如下内容
JAVA_HOME=/usr/java/jdk-1_5_0_
CLASSPATH=/usr/java/jdk-1_5_0_/lib/dt.jar:/usr/java/jdk-1_5_0_/lib/tools.jar
PATH=/usr/java/jdk-1_5_0_/bin: $PATH
export PATH JAVA_HOME CLASSPATH
B 安装Apache
# cd /usr/local/
# tar xvfz httpd-2.0..tar.gz
# cd httpd-2.0.
# ./configure --prefix=/usr/local/apache --enable-module=so
# make
# make install
# cd /usr/local/apache/conf
# vi ./httpd.conf
将Listen 修改为Listen .0.0.1: (行)
将ServerName 修改为ServerName LocalHost: (行)
在DirectoryIndex中添加 index.jsp (行)
# cd /usr/local/apache/bin/
# ./apachectl configtest
显示Syntax ok则表明安装成功
#./apachectl start
启动apache服务,浏览器中访问本机端口,查看端口是否正常,输入.0.0.1:
# ./apachectl stop
关闭服务
备注:prefix定义apache的安装路径
C安装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
第行加入此句
JAVA_HOME=/usr/java/jdk-1_5_0_
启动服务后,访问本机端口,查看端口是否正常(输入.0.0.1:)
# /usr/local/tomcat/bin/startup.sh /startup.bat
关闭服务
# /usr/local/tomcat/bin/shutdown.sh /shutdown.bat
D 安装JK
# cd /usr/local/
# tar xzvf jakarta-tomcat-connectors-1.2.-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.-src/jk/native
# chmod buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
# cd /usr/local/jakarta-tomcat-connectors-jk1.2.-src/jk/native/apache-2.0/
# cp mod_jk.so /usr/local/apache/modules/
E 系统整合
# vi /usr/local/apache/conf/httpd.conf
在文件最末尾加上如下语句
#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
添加下列语句
#
# 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=
worker.tomcat1.host=.0.0.1
worker.tomcat1.type=ajp
# 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=
# ------------------------
# Second tomcat server
# ------------------------
worker.tomcat2.port=
worker.tomcat2.host=..1.
worker.tomcat2.type=ajp
# 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=
# ------------------------
# 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="" protocol="AJP/1.3" /> 第行
在行左右加入如下语句(去注释)
若第二台tomcat,将jvmRoute的修改为tomcat2
系统整合完毕
启动apache和tomcat服务
# /usr/local/apache/bin/apachectl start
# /usr/local/tomcat/bin/catalina.sh start
将如下内容添加至/etc/rc.d/rc.local文件末尾
以便系统启动后开启apache,tomcat服务
#vi /etc/rc.d/rc.local
添加
/usr/local/tomcat/bin/catalina.sh start
/usr/local/apache/bin/apachectl start
linux系统vi命令详解 进入vi的命令vifilename:打开或新建文件,并将光标置于第一行首vi+nfilename:打开文件,并将光标置于第n行首vi+filename:打开文件,并将光标置于最后一行
RHEL5 Apache+Tomcat整合,同时支持jsp与php 配置环境:OS:RHEL5withkernel2.6.-8.1.1.el5httpd-2.2.3-6.el5.i.rpmapache-tomcat-6.0..tar.gzjdk-6u3-linux-i.binmod_jk-1.2.-apache-2.2.x-linux-i.so官方宣称mod_jk-1.2.-httpd-2.2.
查看Apache的在线用户数方法 #netstat-n|awk'/^tcp/{++S[$NF]}END{for(ainS)printa,S[a]}'
标签: jsp环境变量配置的步骤
本文链接地址:https://www.jiuchutong.com/biancheng/359224.html 转载请保留说明!友情链接: 武汉网站建设