Apach2.0 でTomcat4.1と連携 - 2007年の実験
Modified: 30 April 2007
ApacheとTomcatの連携は、双方がしょっちゅうバージョンアップされることから最新版の解説をしたところもないし、本をみるとすごく複雑に書かれていて、なかなかきちんと分かりませんので、いつも悩まされます。
今回、どうしても連携したいので、腰をすえて実験してみました。
ソースのダウンロード
バイナリがあればいいのですが、CentOS3で使えそうなバイナリが見つけられませんでしたので、ソースコードからやってみました。
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk2/v2.0.2/src/
2007年4月30日時点で、"jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz"がダウンロードできました。
以下のように解凍します。
# tar zxvf jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz
ビルドする
解凍した以下のディレクトリに移動します。
# cd jakarta-tomcat-connectors-jk2-2.0.2-src/jk/native2コンフィグします。
# ./configure --with-apxs2=/usr/sbin/apxs --with-tomcat41=/usr/local/tomcat4 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets ${MAKE}... yes checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for style of include used by make... GNU checking dependency style of gcc... none checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for ld used by GCC... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognise dependant libraries... pass_all checking command to parse /usr/bin/nm -B output... ok checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking for ranlib... ranlib checking for strip... strip checking for objdir... .libs checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.lo... yes checking if gcc supports -fno-rtti -fno-exceptions... yes checking whether the linker (/usr/bin/ld) supports shared libraries... yes checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking dynamic linker characteristics... GNU/Linux ld.so checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking whether -lc should be explicitly linked in... no creating libtool checking for test... /usr/bin/test checking for rm... /bin/rm checking for grep... /bin/grep checking for echo... /bin/echo checking for sed... /bin/sed checking for cp... /bin/cp checking for mkdir... /bin/mkdir no apxs given need to check for Perl first, apxs depends on it... checking for perl... /usr/bin/perl building connector for "apache-2.0" checking for tomcat33 location... not provided checking for tomcat40 location... not provided checking for tomcat41 location... /usr/local/tomcat4 checking for JDK location (please wait)... /usr/java/j2sdk1.4.2_04 from environment checking Java platform... checking Java platform... checking os_type directory... linux configure: creating ./config.status config.status: creating Makefile config.status: creating server/apache13/Makefile config.status: creating server/apache13/Makefile.apxs config.status: creating server/apache2/Makefile config.status: creating server/apache2/Makefile.apxs config.status: creating ../build.properties config.status: creating scripts/build/unix/dummy config.status: executing depfiles commands #makeします。
# make
インストールする
インストールします。
# cp ../build/jk2/apache2/mod_jk2.so /etc/httpd/modules/ # cp ../conf/workers2.properties /etc/httpd/conf"/etc/httpd/conf/http.conf"に以下を追加します。
LoadModule jk2_module modules/mod_jk2.so
"mod_jk2.conf"は要りません。