作者 主題: [分享]Tomcat5及Apache2.0 on Redhat 9  (閱讀 6555 次)

0 會員 與 1 訪客 正在閱讀本文。

Keyman

  • 懷疑的國中生
  • **
  • 文章數: 37
    • 檢視個人資料
[分享]Tomcat5及Apache2.0 on Redhat 9
« 於: 2005-10-26 11:32 »
因為小弟在過去幾天都是搞Tomcat與Apache的連接,一直搞不上,爬了好久的文也解決不了,終於在昨天把問題解決了,所有想佔一下版面,把打好了的文件紀錄,POST上來跟各位大大分享:

套件使用 "中華民國開放系統協會" 製作的Tomcat 5
Apache是Redhat 9原機安裝的rpm版本,2.0.40

Prepare:
Require:j2sdk-1_4_2_09-linux-i586-rpm.bin
jakarta-tomcat-5.0-28.noarch.rpm
jpackage-utils-1.5.39-1jpp.noarch.rpm
jakarta-tomcat-connectors-1.2.14.1-src.tar.gz

Install:
# ./j2sdk-1_4_2_09-linux-i586-rpm.bin
# rpm -ivh j2sdk-1_4_2_09-linux-i586-rpm
# rpm –ivh jpackage-utils-1.5.39-1jpp.noarch.rpm
# cd /usr/java# ln –s /usr/java/j2sdk1.4.2_09 /usr/java/j2sdk

Change /etc/profile
# vi /etc/profile
add JAVA_HOME="/usr/java/j2sdk" & export JAVA_HOME

JAVA_HOME="/usr/java/j2sdk"
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME

Save and exit

# . /etc/profile (Reload config)
# echo $JAVE_HOME

If return /usr/java/j2sdk, setting OK.


Install tomcat5 & connector
#rpm -ivh jakarta-tomcat-5.0-28.noarch.rpm
#tar zxvf jakarta-tomcat-connectors-1.2.14.1-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.14.1-sr/native
# ./buildconf.sh
# ./configure --with-apxs=/usr/sbin/apxs
# make
# make install
# cp apache-2.0/mod_jk.so /etc/httpd/modules


Config Apache & Tomcat


# vi /etc/httpd/conf/workers.properties

copy the following details to the file

 

[shm]

file=/etc/httpd/logs/jk2.shm

size=1048576

[channel.socket:localhost:8009]

port=8009

host=127.0.0.1

[ajp13:localhost:8019]

channel=channel.socket:localhost:8009

[uri:/*.jsp]

worker=ajp13:localhost:8009

 

# vi /etc/httpd/conf/httpd.conf

add:

LoadModule jk_module modules/mod_jk.so &

JkWorkersFile /etc/httpd/conf/workers.properties
JkMount /*.jsp ajp13

JkMount /servlet/* ajp13

 

# vi /etc/tomcat5/tomcat5.conf

At the beginning:

# tomcat5 service configuration file

 

# you could also override JAVA_HOME here

# Where your java installation lives

JAVA_HOME="/usr/java/j2sdk" (Cancel the remark & change the path)

 

# vi /etc/tomcat5/server.xml

For Virtualhost setting, before </Engine>, add the following:

 

<Host name="yourdomainname" debug="0"

appBase="yourpath"

unpackWARs="true" autoDeploy="true">

 

<Context path="" docBase="" debug="1"/>

 

<Valve className="org.apache.catalina.valves.AccessLogValve"

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

  pattern="common" resolveHosts="false"/>

</Host>


Reference materials:
Package DL
http://www.cosa.org.tw/cosa_act/tm/tomcat/
http://java.sun.com
http://tomcat.apache.org/connectors-doc/

以上資料如有遺缺或錯誤還請各位大大指正呢,先謝過啦 :D

Keyman

  • 懷疑的國中生
  • **
  • 文章數: 37
    • 檢視個人資料
[分享]Tomcat5及Apache2.0 on Redhat 9
« 回覆 #1 於: 2005-10-26 23:49 »
同樣實作在Centos 4.2上已證實沒問題

要注意的是
#tar zxvf jakarta-tomcat-connectors-1.2.14.1-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.14.1-sr/native
實際上應為
# jakarta-tomcat-connectors-1.2.14.1-sr/jk/native