APACHE2+TOMCAT5+LINUX9配置过程
1. 准备:(目录:/www/tmp)
httpd-2.0.50.tar.gz
jakarta-tomcat-5.0.18.tar.gz
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
j2sdk-1_4_2-linux-i586-rpm
2. 安装JDK1.4
直接运行JDK rpm, 默认情况下安装在/usr/java下
rpm –ivh j2sdk-1_4_2-linux-i586-rpm
编辑全局变量
vi /etc/profile
添加:JAVA_HOME=/usr/java/ j2sdk-1_4_2
export JAVA_HOME
验证设置
echo $JAVA_HOME
3. 安装APACHE
解压原码包
tar –zxvf httpd-2.0.50.tar.gz
配置路径和选项
./configure --prefix=/usr/local/apache2 --enable-mods-shared=all
make
make install
测试
./usr/local/apache2/bin/apachectl start
http://localhost
4. 安装TOMCAT
复制代码包到/usr/local下
cp jakarta-tomcat-5.0.18.tar.gz /usr/local
解压该包
tar –zxvf jakarta-tomcat-5.0.18.tar.gz
配置全局变量
vi /etc/profile
添加:
CATALINA_HOME=/usr/local/ jakarta-tomcat-5.0.18
export CATALINA_HOME
测试
./usr/local/apache2/apachectl start
http://localhost:8080
5. 编译连接器
解压源码包
tar –zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
修改配置
cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2
./configure
--with-apxs2=/usr/local/apache2/bin/apxs --with-apr-lib=/usr/local/apache2/bin
--with-tomcat-41=/usr/local/jakarta-tomcat-5.0.18 --with-java-home=/usr/java/ j2sdk-1_4_2
--with-jni
修改MAKEFILE文件(为了包含所必须的类,否则会在TOMCAT启动时报错)
cd /www/tmp/ jakarta-tomcat-connectors-jk2-2.0.4-src /jk/native2/server/apache2
找到:
ifdef APR_LIBDIR_LA
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
else
JK_LDFLAGS=-lcrypt ${APR_LIBS}
endif
替换为:
ifdef APR_LIBDIR_LA
JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt
else
JK_LDFLAGS=-lcrypt ${APR_LIBS} JK_LDFLAGS=-lcrypt ${APR_LIBS} -L/usr/local/apache2/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat
endif
make
回到native2目录
进入build目录,运行APXS
cd ../build/jk2/apache2
/usr/local/httpd/bin/apxs -n jk2 -i mod_jk2.so
将生成的文件拷贝到APACHE下
# cp libjkjni.so /usr/local/apache2/modules/jkjni.so
# cp mod_jk2.so /usr/local/apache2/modules/
6. 配置
配置jk2.properties
cd /usr/local/jakarta-tomcat-5.0.18/conf
vi jk2.properties
去掉 shm.file 前的 # 拿掉,並且設定 jk2.shm 位置为/usr/local/ apache2/logs/ jk2.shm
# shm.file=/usr/local/apache/logs/jk2.shm ---- shm.file=/usr/local/apache2/logs/jk2.shm
配置httpd.conf
cd /usr/local/apache2/conf
vi httpd.conf
找到LOAD块,在其下添加:
LoadModule jk2_module modules/mod_jk2.so
配置workers2.properties
cd /usr/local/apache2/conf
vi workers2.properties
添加如下代码:
# ------- start ---------
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
[channel.socket:localhost:8009]
tomcatId=localhost:8009
[uri:/jsp-examples/*]
# --------end ------------
7. 测试
http://localhost/jsp-examples
8. 问题:
在apache启动后的日志(/usr/loal/apache2/logs/error_log)里如果发现这样的错误:
channelSocket.open() connect failed localhost:8009 146 Connection refused
请检查workers2.properties配置是否正确
在TOMCAT启动后的日志(/usr/local/tomcat/logs/Catalina.out)里如果发现这样的错误:
INFO:APRnotloaded,disablingjnicomponents:java.io.IOException:java.lang.UnsatisfiedLinkError: /usr/local/apache2/modules/jkjni.so:/usr/local/apache2 /modules/jkjni.so: undefined symbol: apr_md5_final
请检查是否正确修改了MAKEFILE
李高峰
QQ: 180323536
msn: lushanlee@hotmail.com
email: ligf@sports.cn
qqljc 回复于:2004-09-22 09:06:50 | ||
好复杂啊
看的我头晕啊 | ||
骑墙男人 回复于:2004-09-22 09:39:49 | ||
等等我把详细的界面操作过程给你 | ||
jsean 回复于:2004-09-23 12:36:05 | ||
在第五步 编译连接器中修改Makefile配置文件时,我在Makefile文件中没有找到要修改的语句段,而在Makefile.in中却找到了, 你看要修改吗? | ||
骑墙男人 回复于:2004-09-23 13:23:48 | ||
[root@localhost jakarta-tomcat-connectors-jk2-2.0.4-src]# ls
build.properties.default doc lib README.txt xxx build.xml jk LICENSE RELEASE-NOTES.txt common KEYS NOTICE scandoc [root@localhost jakarta-tomcat-connectors-jk2-2.0.4-src]# cd jk [root@localhost jk]# cd native2 [root@localhost native2]# ls aclocal.m4 build.xml config.status jni scripts apr CHANGES.html configure libtool server autom4te.cache CHANGES.txt configure.in Makefile STATUS.txt buildconf.sh common include Makefile.in tomcat BUILD.txt config.log INSTALL.txt README.txt [root@localhost native2]# cd server [root@localhost server]# ls aolserver apache13 apache2 dsapi isapi [root@localhost server]# cd apache2 [root@localhost apache2]# ls bldjk2.qclsrc jk_map_aprtable.c Makefile.apxs mod_jk2.c jk_apache2.h jk_service_apache2.c Makefile.apxs.in mod_jk2.dsp jk_logger_apache2.c Makefile Makefile.in NWGNUmakefile [root@localhost apache2]# vi Makefile # Gnu makefile and libtool are required # use -D options to overrides defaults CC=gcc CP=/bin/cp prefix=/usr/local exec_prefix=${prefix} APACHE2_HOME=/usr/local/apache2 OS=linux JAVA_HOME=/usr/java/j2sdk1.4.2_05 APACHE2_INCL=-I/usr/local/apache2/include APACHE2_LIBEXEC=/usr/local/apache2/modules APACHE2_LIBDIR=/usr/local/apache2/lib APR_INCL= -I/usr/local/httpd-2.0.50/srclib/apr-util/include -I/usr/local/httpd-2.0.50/srclib/apr/include APR_LIBS=-L/usr/local/apache2/lib -lapr-0 APR_LIBDIR_LA= EXTRA_CFLAGS=-O2 -pthread EXTRA_CPPFLAGS=-DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE ifneq ($(strip $(JAVA_HOME)),) JAVA_INCL=-I ${JAVA_HOME}/include -I ${JAVA_HOME}/include/${OS} JAVA_LIB=-L ${JAVA_HOME}/jre/lib/${ARCH} -L ${JAVA_HOME}/lib/${ARCH}/native_threads endif JK_DIR := ../.. BUILD_DIR = ${JK_DIR}/../build/jk2/apache2 # Extract EXTRA_CFLAGS and EXTRA_CPPFLAGS - same flags used during apache2 # compilation #include ${APACHE2_HOME}/build/config_vars.mk # Yes, we use the same properties file as ant #include ../../../build.properties LIBTOOL=/bin/sh /usr/local/apache2/build/libtool --silent # It doesn't hurt if we include all INCLUDES= -I${JK_DIR}/include \ ${APACHE2_INCL} \ ${APR_INCL} \ ${JAVA_INCL} JK_CFLAGS=-DCHUNK_SIZE=4096 -DUSE_APACHE_MD5 -DHAVE_JNI [b:c4505e8056]ifdef APR_LIBDIR_LA JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt[/b:c4505e8056] | ||
骑墙男人 回复于:2004-09-23 13:27:42 | ||
[root@localhost jakarta-tomcat-connectors-jk2-2.0.4-src]#[b:35ee3f0ac1] ls[/b:35ee3f0ac1]
build.properties.default doc lib README.txt xxx build.xml jk LICENSE RELEASE-NOTES.txt common KEYS NOTICE scandoc [root@localhost jakarta-tomcat-connectors-jk2-2.0.4-src]# [b:35ee3f0ac1]cd jk[/b:35ee3f0ac1] [root@localhost jk]# [b:35ee3f0ac1]cd native2[/b:35ee3f0ac1] [root@localhost native2]#[b:35ee3f0ac1] ls[/b:35ee3f0ac1] aclocal.m4 build.xml config.status jni scripts apr CHANGES.html configure libtool server autom4te.cache CHANGES.txt configure.in Makefile STATUS.txt buildconf.sh common include Makefile.in tomcat BUILD.txt config.log INSTALL.txt README.txt [root@localhost native2]# [b:35ee3f0ac1]cd server[/b:35ee3f0ac1] [root@localhost server]# [b:35ee3f0ac1]ls[/b:35ee3f0ac1] aolserver apache13 apache2 dsapi isapi [root@localhost server]# cd apache2 [root@localhost apache2]#[b:35ee3f0ac1] ls[/b:35ee3f0ac1] bldjk2.qclsrc jk_map_aprtable.c Makefile.apxs mod_jk2.c jk_apache2.h jk_service_apache2.c Makefile.apxs.in mod_jk2.dsp jk_logger_apache2.c Makefile Makefile.in NWGNUmakefile [root@localhost apache2]# [b:35ee3f0ac1]vi Makefile[/b:35ee3f0ac1] # Gnu makefile and libtool are required # use -D options to overrides defaults CC=gcc CP=/bin/cp prefix=/usr/local exec_prefix=${prefix} APACHE2_HOME=/usr/local/apache2 OS=linux JAVA_HOME=/usr/java/j2sdk1.4.2_05 APACHE2_INCL=-I/usr/local/apache2/include APACHE2_LIBEXEC=/usr/local/apache2/modules APACHE2_LIBDIR=/usr/local/apache2/lib APR_INCL= -I/usr/local/httpd-2.0.50/srclib/apr-util/include -I/usr/local/httpd-2.0.50/srclib/apr/include APR_LIBS=-L/usr/local/apache2/lib -lapr-0 APR_LIBDIR_LA= EXTRA_CFLAGS=-O2 -pthread EXTRA_CPPFLAGS=-DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE ifneq ($(strip $(JAVA_HOME)),) JAVA_INCL=-I ${JAVA_HOME}/include -I ${JAVA_HOME}/include/${OS} JAVA_LIB=-L ${JAVA_HOME}/jre/lib/${ARCH} -L ${JAVA_HOME}/lib/${ARCH}/native_threads endif JK_DIR := ../.. BUILD_DIR = ${JK_DIR}/../build/jk2/apache2 # Extract EXTRA_CFLAGS and EXTRA_CPPFLAGS - same flags used during apache2 # compilation #include ${APACHE2_HOME}/build/config_vars.mk # Yes, we use the same properties file as ant #include ../../../build.properties LIBTOOL=/bin/sh /usr/local/apache2/build/libtool --silent # It don'''t hurt if we include all INCLUDES= -I${JK_DIR}/include \ ${APACHE2_INCL} \ ${APR_INCL} \ ${JAVA_INCL} JK_CFLAGS=-DCHUNK_SIZE=4096 -DUSE_APACHE_MD5 -DHAVE_JNI [b:35ee3f0ac1]ifdef APR_LIBDIR_LA JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt[/b:35ee3f0ac1] | ||
jsean 回复于:2004-09-23 13:53:57 | ||
能否接着把下面的地方也贴出来,包括修改后的代码,呵呵 | ||
wxijin 回复于:2004-09-23 15:00:19 | ||
你配置虚拟主机成功没有呢,我试过多次都不行,有空交流下. | ||
jsean 回复于:2004-09-23 15:08:46 | ||
替换为:
ifdef APR_LIBDIR_LA JK_LDFLAGS=-L${APACHE2_LIBDIR} -lcrypt else JK_LDFLAGS=-lcrypt ${APR_LIBS} JK_LDFLAGS=-lcrypt ${APR_LIBS} -L/usr/local/httpd-2.0.49/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat endif 上面的语句有两个地方不明白,分别是: 1. else下面那条语句前面的第一个 "JK_LDFLAGS=-lcrypt ${APR_LIBS} "是否可以不要 2.下面这句 “-L/usr/local/httpd-2.0.49/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat” 中的的/usr/local/httpd-2.0.49我就没有这个路径。 另外注一下: 我的系统是AS3, 安装时好象没有安装系统自带的apache。 我装的Aapache版本是httpd-2.0.51.tar.gz Tomcat的版本是jakarta-tomcat-5.0.28.tar.gz | ||
骑墙男人 回复于:2004-09-23 15:18:45 | ||
我直接把这两个文件给大家,如果由于版本不同而造成的不可用,本人不承担任何责任. | ||
jsean 回复于:2004-09-23 15:28:55 | ||
-L/usr/local/httpd-2.0.49/lib -laprutil-0 -lgdbm -ldb-4.0 -lexpat
哦,楼主能否说一下上面这句是怎么会事,谢了先 | ||
骑墙男人 回复于:2004-09-23 16:02:58 | ||
指到自己的lib目录中呀
比如你的APACHE的安装目录为: /usr/local/apache2 那就应该变为 /usr/local/apache2/lib | ||
mymmsc 回复于:2004-09-23 17:15:15 | ||
看不明白,打电话,哈哈~~~~ | ||
wlei007 回复于:2004-09-24 18:56:45 | ||
:(
我的/usr/local/apache2/conf目录下没有workers2.properties文件,怎么办啊! | ||
骑墙男人 回复于:2004-09-25 09:39:39 | ||
可以自己新建一个呀
vi workers2.properties | ||
skycao 回复于:2004-10-09 08:06:51 | ||
我在这里不明白
make 回到native2目录 进入build目录,运行APXS cd ../build/jk2/apache2 /usr/local/httpd/bin/apxs -n jk2 -i mod_jk2.so 将生成的文件拷贝到APACHE下 # cp libjkjni.so /usr/local/apache2/modules/jkjni.so # cp mod_jk2.so /usr/local/apache2/modules/ | ||
skycao 回复于:2004-10-09 08:10:20 | ||
APXS 在哪里运行啦? | ||
骑墙男人 回复于:2004-10-09 09:07:29 | ||
如有不明白操作的,请看这篇文章.
http://bbs.chinaunix.net/forum/13/20040930/416854.html | ||
skycao 回复于:2004-10-09 10:52:57 | ||
http://localhost/jsp-examples
是对的` 但其他的目录却不没有交给tomcat处理. 其他目录的jsp文件解析不了!~ | ||
骑墙男人 回复于:2004-10-09 11:20:42 | ||
联系我 | ||
skycao 回复于:2004-10-10 16:11:46 | ||
已经联系你啦` | ||
骑墙男人 回复于:2005-05-27 21:16:20 | ||
大家好,有很多朋友提出了许多引申的问题,为了及时解答,请大家登录到本人的网站,可以获取更多信息和资源。
http://sp.chinaident.com 注册后,可以获取相关信息还有更多相关技术支持。 | <
文章来源于领测软件测试网 https://www.ltesting.net/
领测软件测试网最新更新
关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073