It is advisable to run Tomcat standalone, not connected through Apache httpd, because you will lose at least 50% of Tomcat's response performance by proxying all requests through an Apache httpd module first. For benchmarks and additional details on why you should run Tomcat standalone, see Tomcat: The Definitive Guide, 2nd Edition (O'Reilly).
If you decide that you must run Tomcat behind Apache httpd, we suggest using only the built-in mod_proxy module for proxying the requests to Tomcat. To use mod_proxy, search for the following lines in your Apache httpd's configuration files, and add them if they don’t already exist:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
Next, add the following lines anywhere after the LoadModule lines:
ProxyPass /tcat http://127.0.0.1:8080/ ProxyPassReverse /tcat http://127.0.0.1:8080/ ProxyVia On
These lines tell Apache httpd to proxy all requests it receives for
/tcat*via the HTTP protocol into Tomcat's HTTP connector running on port 8080. Make sure to restart httpd after making the configuration change, and inspect the error log for any problems before proceeding.
server.xmlfile, make sure that there is a port 8080
<Connector>element that is enabled in the configuration. Also, you probably want to set your Connector's
proxyPortattributes to values that match your Apache httpd web server's host name and port number, so that the responses from Tomcat appear to be coming from Apache httpd. For more information on configuring the
<Connector>element, see the Connector page in the official Tomcat documentation at http://tomcat.apache.org/tomcat-6.0-doc/config/http.html.
Want to cash in on your IT savvy? Send your tip to firstname.lastname@example.org. If we post it, we'll send you a $25 Amazon e-gift card.