Integrating Apache 2.05 with Tomcat 5.5

Asked by selie

I just finished my first ever webapp that uses Tomcat and would like it to integrate with the apache server that is running on the same machine.. I tried a couple of scenarios I found on the net but they did not work for me.
 Here is the info of the machine and apps
* The Tomcat is running from port 8080 and the apache is running from the default port. (80)
* The OS is Ubuntu 6.10 Edgy Eft

By the way, I could not also install mod_jk (Tomcat's connector module) from the source, as I am missing apxs; thus I had to install the binary.... Any idea, how I can install apxs..
++ this has been solved now
% apt-get install apache2-dev

Thanks...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
selie
Solved:
Last query:
Last reply:
Revision history for this message
selie (selamawi) said :
#1

I just want to let you that I managed to install apxs..by running
% apt-get install apache2-install

I am going try to compile mod_jk and will let you how it goes..

Revision history for this message
Best selie (selamawi) said :
#2

1. Download JK 1.2.23 from http://tomcat.apache.org/connectors-doc/
2. gunzip and untar the downloaded file
3. compile
4. Make sure that mod_jk.so is under /usr/lib/apache2/modules/

5. Replace the Host and Connector tags of the default $TOM_DIR/conf/server.xml
<Host name="domainName"
    appBase="${TOM_DIR}/webapps"
    autoDeploy="false"
    deployOnStartup="false"
    unpackWARs="false"
    deployXML="true"
    debug="0"/>

  <Connector address="127.0.0.1"
   port="8009"
   minProcessors="5"
   maxProcessors="75"
   enableLookups="false"
   protocol="AJP/1.3"
   debug="0"/>

6. Create /${TOM_DIR}/conf/jk/mod_jk.conf-auto
   Some where I read, there is a way of creating this file automatically
   but it did not work for me, thus I entered the following info manually..

root# cat /${TOM_DIR}/conf/jk/mod_jk.conf-auto
# Load mod_jk module
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

7. I had to add one line to /etc/apache2/httpd.conf to load mod_jk.conf-auto
root# cat httpd.conf
Include /${TOM_DIR}/conf/jk/mod_jk.conf-auto

8. Create the workers.properties file
root# cat /etc/apache2/workers.properties
# workers.properties - ajp13
#
# List workers
worker.list=wrkr
#
# Define wrkr
worker.wrkr.port=8009
worker.wrkr.host=localhost
worker.wrkr.type=ajp13
worker.wrkr.cachesize=10
worker.wrkr.cache_timeout=600
worker.wrkr.socket_timeout=300

9. Add the following lines to /etc/apache2/sites-available/default

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
 ServerAdmin webmaster@domainName
 ServerName {domainName}
 DocumentRoot /${TOM_DIR}/webapps/YOUR_APP
 ErrorLog /${TOM_DIR}/webapps/logs/error_log
 CustomLog /${TOM_DIR}/webapps/logs/access_log common
 JkMount /*.jsp wrkr
 JkMount /servlet/* wrkr
 # Deny direct access to WEB-INF
 <LocationMatch ".*WEB-INF.*">
  AllowOverride None
  deny from all
 </LocationMatch>
</VirtualHost>

10. Now restart apache

root# /etc/init.d/apache restart

11. Restart Tomcat

For more info please refer to http://www.meritonlinesystems.com/docs/apache_tomcat_redhat.html.. I used this
page as a reference and guide to config the files mentioned above..