I want to access Tomcat through the Apache-webserver using connectors. I sticked to the documentation: http://tomcat.apache.org/connectors-doc/generic_howto/quick.html I only modified it a little to match directory-structure used on my Debian-(Squeeze)-System.
So I added the following to /etc/apache2/httpd.conf:
# Load mod_jk module # Update this path to match your modules location #LoadModule jk_module libexec/mod_jk.so # Declare the module for <IfModule directive> (remove this line on Apache 2.x) #AddModule mod_jk.c # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/apache2/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /var/log/apache2/mod_jk.shm # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) 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] " # Send everything for context /examples to worker named worker1 (ajp13) JkMount /tomcat7/* worker1
I commented out the loading of the module, because that already happens, after I installed mod_jk through the package-system (libapache2-mod-jk).
My workers.properties look like this:
# Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009
Tomcat 7 is installed directly from archive from Apache, because it is not a package in Squeeze. Tomcat 7 is running and reachable under it's own port (8180, to not collide with tomcat6 from the package-system). As far as I understand, I should see now the tomcat-site with http://host/tomcat7/. But I get a 404 instead. What is wrong?
After quanta hinted to set the log-level to debug (thanks) I did that and found the following error-message in mod_jk.log: 'jk_map_to_storage::mod_jk.c (3585): missing uri map for 18.104.22.168:/tomcat7/'. I googled for that and found http://old.nabble.com/mod_jk%2C-missing-uri-map-td23984359.html
So the options set in httpd.conf weren't used in VirtualHosts. I added 'JkMountCopy On' to my VirtualHost - and got first a Tomcat 404 (instead of the httpd 404). Problem here, that he tries to access the exact same URI mounted, so in my case /tomcat7. I used instead the name of the webapp as mount and everything is fine for me.