September 12, 2011

Apache2 + Tomcat6 on Amazon Linux image

From couple of days, I was having issues configuring Apache 2 to re-direct requests to Tomcat 6 on Ubuntu Linux image. Finally resolved the issue today.
Amazon Linux image which I was configuring is linux-image-2.6.32-316-ec2
Basic tutorial of Apache2 HTTPD is here.
Below are the basic steps (assuming Tomcat 6 and Apache 2 are already installed and configured):
apt-get install libapache2-mod-jk

sudo vim /etc/apache2/

# Define 1 real worker using ajp13
# Set properties for worker1 (ajp13)

sudo vim /etc/apache2/apache2.conf
#Add the below content at the end of the file
LoadModule    jk_module  /usr/lib/apache2/modules/
JkWorkersFile /etc/apache2/
JkShmFile     /var/log/apache2/mod_jk.shm
JkLogFile     /var/log/apache2/mod_jk.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

sudo vim /etc/apache2/sites-enabled/000-default
#Replace "DocumentRoot /var/www" 
#with the below 
JkMount / worker1
JkMount /* worker1

sudo /etc/init.d/apache2 restart

Note: In my case Connector port="8009" was already enabled in /etc/tomcat6/server.xml.
References : here

No comments: