Apache + mod_jk + Tomcat on Amazon Linux

Installing Apache

#yum install httpd.x86_64
#chkconfig httpd on

Install Java

Installing Tomcat from source
cd /opt
wget “http://apache.mirrors.lucidnetworks.net/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz”
tar xvzf apache-tomcat-7.0.42.tar.gz
/opt/apache-tomcat-7.0.42/bin/startup.sh

Installing mod_jk connector

Prerequisite : #yum install libtool httpd-devel autoconf.noarch
http://tomcat.apache.org/download-connectors.cgi
#wget “http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.32-src.tar.gz”
#tar xvzf tomcat-connectors-1.2.32-src.tar.gz
#mv tomcat-connectors-1.2.32-src /usr/src/
#cd /usr/src/tomcat-connectors-1.2.32-src/native
#./buildconf.sh
#./configure –with-apxs=/usr/sbin/apxs
ERROR — rm: cannot remove `libtoolT’: No such file or directory
Change the line in “configure” file
$RM “$cfgfile”
to
$RM -f “$cfgfile”

Build mod_jk with the following command

#make
#cp apache-2.0/mod_jk.so /etc/httpd/modules/
#export CATALINA_HOME=/opt/apache-tomcat-7.0.42
#mkdir /opt/apache-tomcat-7.0.42/conf/jk
Configuring Tomcat for mod_jk

The workers.properties file contains information so mod_jk can connect to the Tomcat worker processes.
#vim /opt/apache-tomcat-7.0.42/conf/jk/workers.properties

workers.tomcat_home=/opt/apache-tomcat-7.0.42
workers.java_home=/usr/lib/jvm/jdk6
ps=/
worker.list=myworker
worker.myworker.port=8009
worker.myworker.host=localhost
worker.myworker.type=ajp13
worker.myworker.lbfactor=1
Configuring Apache
httpd.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile /opt/apache-tomcat-7.0.42/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat “[%a %b %d %H:%M:%S %Y]”
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”
JkMount /* myworker

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s