mod_jk2整合Tomcat 5与Apache 2.0.48(TCP/IP Socket方式)
2004-04-23 15:18 pm来自:Linux文档
现载:Www.8s8s.coM
地址:无名
这个mod_jk2.so真的是很折磨人
Tomcat 5的安装请看我的这篇帖子http://bbs.chinaunix.net/forum/6/20040214/259794.html
I. Apache 2.0.48的安装和配置
(1)编译安装
代码:
# ./configure --enable-layout=Solaris
--enalbe-modules="so rewrite vhost_alias"
--with-mpm=prefork
# make
# make install
(2)注意这个--enable-layout=Solaris,make install后Apache安装在/usr/apache下,配置文件在/etc/apache下
修改/etc/apache/httpd.conf,把默认的Group #-1改成Group nogroup
(3)设置启动脚本
代码:
# cp /usr/apache/bin/apachectl /etc/init.d/apache
# cd /etc/rc2.d
# ln ../init.d/apache S99apache
# cd ../rc0.d
# ln ../init.d/apache K03apache
II. mod_jk2的编译、配置
需要gcc、autoconf、automake、m4、libtool
(1)编译mod_jk2
代码:
# cd ${tomcat.source}/jakarta-tomcat-connectors/jk/native2
# ./buildconf.sh
# ./configure --with-apxs2=/usr/apache/bin/apxs
--with-java-home=/usr/java
# make
# cd ../build/jk2/apache2
# cp *.so /usr/apache/modules
可能出现的错误信息
代码:
echo not found
解决办法是
代码:
ln -s /usr/bin/echo /usr/local/bin/echo
(2)配置mod_jk2
修改httpd.conf,加入LoadModule jk2_module modules/mod_jk2.so
创建workers2.properties,与httpd.conf放在同一目录下
代码:
#---- worker2.properties
[logger.apache2]
level=DEBUG
# Shared memory handling. Needs to be set.
[shm]
file=/var/apache/logs/shm.file
size=1048576
# Example socket channel, explicitly set port and host.
[channel.socket:localhost:8009]
tomcatId=localhost:8009
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[status:status]
# Uri mapping
[uri:/jkstatus/*]
group=status:status
[uri:/jsp-examples/*]
group=ajp13:localhost:8009
[uri:/servlets-examples/*]
group=ajp13:localhost:8009
#---- end of workers2.properties
Tomcat一端的配置使用默认的jk2.properties,在$CATALINA_HOME/conf下
启动Apache和Tomcat(不用考虑先后顺序),用浏览器测试一下,如果成功,就恭喜你了
如果不成功(404 not found),也恭喜你, 碰到了跟我一样的问题.
配置都没问题,可就是不行
原因很简单:mod_jk2.so没有找到你的workers2.properties文件,可能是因为安装Apache用了
Solaris的layout吧
解决办法,在httpd.conf中加入JkSet config.file /etc/apache/workers2.properties
虽然TCP/IP Socket方式的mod_jk2可以工作了,但用Unxi Socket File和JNI的还是试不出来,还望高人指点
一些链接
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/index.html
http://jakarta.apache.org/tomcat/faq/connectors.html
http://www.pubbitch.org/jboss/mod_jk2.html
http://www.javakaffee.de/wiki/jsp/Wiki?BuildModJk
http://www.pixelfreak.net/howto/apache2_jk2_tomcat/
http://johnturner.com/howto/apache2-tomcat4127-jk-rh9-howto.html