jump to navigation

Setting up apache web server and apache tomcat 5.5 with mod_jk October 22, 2007

Posted by maxmil in : Apache,Debian,tomcat , trackback

To use tomcat for serving java and apache web server for serving other content you can use mod_jk. Here's a bried recap on how i have just configured them under debian.

1) Install both tomcat and apache.

2) Download binary mod_jk.so (from http://tomcat.apache.org/download-connectors.cgi)

3) Copy module to /usr/lib/apache2/modules/mod_jk.so

4) Create file /etc/apache2/mods-available/jk.load
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so

5) Create file /etc/apache2/mods-available/jk.conf
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel error

6) Create file /etc/apache2/workers.properties
# Tomcat and Java configuration #
worker.list=worker1
# Definition for local worker using AJP 1.3 #
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.cachesize=20

7) Create virtual host in /etc/apache/sites-available/myVirtualHost
<VirtualHost 127.0.0.1:80>
ServerName max-p.sytec.tecfa.com
DocumentRoot /home/maxmil/project/tecfa-systec/webapp
ServerAdmin mpimm@tecfa.com
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/systec.log combined
Alias /edita "/home/maxmil/eclipse-tomcat/wtpwebapps/systec-edita"
<Directory "/home/maxmil/eclipse-tomcat/wtpwebapps/systec-edita">
Options Indexes +FollowSymLinks
</Directory>
JkMount /edita/* worker1
<Location "/edita/WEB-INF/">
deny from all
</Location>
</VirtualHost>

8) Enable new modules and site
cd /etc/apache2
ln -s mods-available/jk.load mods-enabled/jk.load
ln -s mods-available/jk.conf mods-enabled/jk.conf
ln -s sites-available/myVirtualHost sites-enabled/myVirtualHost

Comments»

no comments yet - be the first?