分享
 
 
 

整合RH3+TOMCAT5+APACHE2+jk2

王朝system·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

运行环境: RedHat Enterprise 3.0

一. 有关说明

本文的目的是在RH3环境下用JK2整合Apache 和 Tomcat, 不涉及虚拟主机或PHP等. 下面一些步骤或许不是必需的, 请高手指正.

版本号:

Apache: 2.0.49

Tomcat: 5.0.19

jk2: 2.0.4

j2sdk: 1.4.2.04

下载文件: httpd-2.0.49.tar.gz

jakarta-tomcat-5.0.19.tar.gz

jakarta-tomcat-connectors-jk2-src-current.tar.gz

j2sdk-1_4_2_04-linux-i586.bin

安装位置:

Apache - /usr/local/httpd-2.0.49

Tomcat - /usr/local/jakarta-tomcat-5.0.19

j2sdk - /usr/local/j2sdk1.4.2_04

jk2 - /usr/local/jakarta-tomcat-connectors-jk2-2.0.4-src

建立软链接:

ln -s /usr/local/jakarta-tomcat-5.0.19 /usr/local/tomcat

ln -s /usr/local/httpd-2.0.49 /usr/local/apache

ln -s /usr/local/j2sdk1.4.2_04 /usr/local/jdk

有关配置文件的位置:

httpd.conf - /usr/local/apache/conf/httpd.conf

workers2.properties - /usr/local/apache/conf/workers2.properties

server.xml - /usr/local/tomcat/conf/server.xml

jk2.properties - /usr/local/tomcat/conf/jk2.properties

二. 安装步骤

JDK: rpm -ivh j2sdk-1_4_2_03-linux-i586.rpm

Apache: tar xvfz httpd-2.0.49.tar.gz

cd httpd-2.0.47

./configure --prefix=/usr/local/apache --enable-so

make

make install

(注: 安装RH3时, 并没选择安装Web服务)

Tomcat: tar xvfz jakarta-tomcat-5.0.19.tar.gz

编辑文件 /usr/local/tomcat/bin/catalina.sh

在注释行后插入这几行:

JAVA_HOME=/usr/local/jdk/

CATALINA_HOME="/usr/local/tomcat/"

JAVA_OPTS="-Xms256m -Xmx256m"

增加用户和组:

groupadd tomcat

useradd -g tomcat -c "Tomcat User" -d /usr/local/tomcat tomcat

chown -R tomcat:tomcat /usr/local/tomcat

chown -R tomcat:tomcat /usr/local/jakarta-tomcat-5.0.19

mkdir /usr/local/tomcat/webapps/mylog

JK2: tar xvfz jakarta-tomcat-connectors-jk2-src-current.tar.gz

cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2

chmod 755 buildconf.sh

./buildconf.sh

./configure --with-apxs2=/usr/local/apache/bin/apxs ----with-apr-lib=/usr/local/apache/lib --with-tomcat-41=/usr/local/tomcat --with-java-home=/usr/local/jdk --with-jni

make

libtool --finish /usr/local/apache/httpd/modules

cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache2

cp mod_jk2.so /usr/local/apache/modules/

cp libjkjni.so /usr/local/apache/modules/

cd /usr/local/tomcat/logs

touch jk2.shm

usermod -G apache,tomcat apache

启动时运行,编辑文件:/etc/rc.d/rc.local 增加下面两行:

su - tomcat -c /usr/local/tomcat/bin/startup.sh

/usr/local/apache/bin/apachectl start

三. 修改配置文件, 配置文件如不存在, 就创建.

httpd.conf:

注释掉AddDefaultCharset 这行

增加: LoadModule jk2_module modules/mod_jk2.so

workers2.properties: 如下

# only at beginnin. In production uncomment it out

[logger.apache2]

level=DEBUG

[shm]

file=/usr/local/apache/logs/shm.file

size=1048576

# Example socket channel, override port and host.

[channel.socket:localhost:8009]

info=Ajp13 forwarding over socket

tomcatId=localhost:8009

# define the workUntitled 1er

[ajp13:localhost:8009]

channel=channel.socket:localhost:8009

[uri:/jsp-examples/*]

info=Map the jsp-examples webapp

worker=ajp13:localhost:8009

[uri:/servlets-examples/*]

info=Map the servlets-examples webapp

worker=ajp13:localhost:8009

jk2.properties: 如下

## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED

## WHEN YOU EDIT THE FILE.

## COMMENTS WILL BE _LOST_

## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.

# Set the desired handler list

# handler.list=apr,request,channelJni

handler.list=channelSocket,request

#

# Override the default port for the socketChannel

# channelSocket.port=8019

channelSocket.port=8009

# Default:

# channelUnix.file=${jkHome}/work/jk2.socket

# Just to check if the the config is working

# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive

# channelJni.disabled = 0

# And one of the following directives:

# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If set to inprocess the mod_jk2 will Register natives itself

# This will enable the starting of the Tomcat from mod_jk2

# apr.jniModeSo=inprocess

server.xml: 如下

<Server port="8005" shutdown="SHUTDOWN" debug="0"

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"

debug="0"/

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"

debug="0"/

<!-- Global JNDI resources --

<GlobalNamingResources

<!-- Test entry for demonstration purposes --

<Environment name="simpleValue" type="java.lang.Integer" value="30"/

<!-- Editable user database that can also be used by

UserDatabaseRealm to authenticate users --

<Resource name="UserDatabase" auth="Container"

type="org.apache.catalina.UserDatabase"

description="User database that can be updated and saved"

</Resource

<ResourceParams name="UserDatabase"

<parameter

<namefactory</name

<valueorg.apache.catalina.users.MemoryUserDatabaseFactory</value

</parameter

<parameter

<namepathname</name

<valueconf/tomcat-users.xml</value

</parameter

</ResourceParams

</GlobalNamingResources

<Service name="Catalina"

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 --

<Connector port="8080"

maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

enableLookups="false" redirectPort="8443" acceptCount="100"

debug="0" connectionTimeout="20000"

disableUploadTimeout="true" /

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 --

<Connector port="8009"

enableLookups="false" redirectPort="8443" debug="0"

protocol="AJP/1.3" /

<!-- Define the top level container in our container hierarchy --

<Engine name="Catalina" defaultHost="localhost" debug="0"

<!-- Global logger unless overridden at lower levels --

<Logger className="org.apache.catalina.logger.FileLogger"

prefix="catalina_log." suffix=".txt"

timestamp="true"/

<!-- Because this Realm is here, an instance will be shared globally --

<!-- This Realm uses the UserDatabase configured in the global JNDI

resources under the key "UserDatabase". Any edits

that are performed against this UserDatabase are immediately

available for use by the Realm. --

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"

debug="0" resourceName="UserDatabase"/

<Host name="localhost" debug="0" appBase="webapps"

unpackWARs="true" autoDeploy="true"

xmlValidation="false" xmlNamespaceAware="false"

<Logger className="org.apache.catalina.logger.FileLogger"

directory="logs" prefix="localhost_log." suffix=".txt"

tim

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有