[CentOS] Verify tomcat config

Sat Mar 26 10:48:40 UTC 2011
lhecking at users.sourceforge.net <lhecking at users.sourceforge.net>

 I'm going to retire an old RHEL3 server and move the services to CentOS5.
 In particular, the web server is giving me a headache. On the old box, there's
 a hacked-up httpd/mod_jk/tomcat setup, and CentOS is perfect for the new
 box because the required components are included and the whole setup "just
 works" straight from installation.

 There seems to be surprisingly little documentation or how-tos on how to
 migrate from the above setup to httpd/mod_proxy_ajp/tomcat. I believe I
 have it working correctly on a test machine, but am looking for someone to
 look over the config to make sure it's correct and complete.

 The desired setup is:
 - httpd receives all requests
 - httpd processes all requests for static content
 - httpd passes all requests for dynamic content to tomcat

 Most examples I found seem to assume that all queries, including static, are
 pased on to tomcat. To implement the correct behaviour, I came up with this
 conf.d fragment:

<LocationMatch ".*WEB-INF.*">
    AllowOverride None
    deny from all

<Proxy *>
  AddDefaultCharset Off
  Order deny,allow
  Allow from all

ProxyPreserveHost on
ProxyPassMatch ^(.*\.jsp)$ ajp://localhost:8009/$1

 The second bit was much harder to figure out - point tomcat to httpd's
 DocumentRoot. I came up with the following snippet: use the included
 /etc/tomcat/server-minimal.xml as server.xml and make the following change:

--- server-minimal.xml	2010-10-11 00:16:41.000000000 +0100
+++ server.xml	2011-03-20 01:48:12.000000000 +0000
@@ -18,7 +18,9 @@
     <Engine name="Catalina" defaultHost="localhost">
       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
              resourceName="UserDatabase" />
-      <Host name="localhost" appBase="webapps" />
+      <Host name="localhost" appBase="webapps">
+       <Context path="" docBase="/var/www/html" reloadable="true" />
+     </Host>

 Any comments/suggestions? Would I be better of to stick with mod_jk even
 on CentOS?