Many sites run two web servers - Apache httpd is ideal for plain HTML documents and scripts / programs that are single pages, run rarely, not all linked in together. Whereas Tomcat is an application container that suits applications that are run by tens of people all at the same time - great for banking, student record handling systems, big document and data portals ....
Do you choose one
or the other? Not usually - you can run them both and then connect them - see
the connector story for details.
During the last course I gave before Christmas, we connected the two servers using mod_proxy, using mod_jk, and even using mod_rewrite to share out the Tomcat load between multiple Tomcat servers. Links -
description and
link to sample configuration files.
Here's a handful of extra tips.
1. Why not point both httpd AND Tomcat's Document Root at
the same directory? That way, you can keep your application in one place and configure your connector to forward ONLY servlets and .jsp-s. The result is an application that's easy to maintain, but at the same time is efficiently using the most efficient server for each element.
2. In early testing and at time you've been reconfiguring, it's worth
turning your Tomcat off to test the httpd element rather than starting your tests with everything switched on. The uncommon httpd response codes that you'll get tell you heaps about what's going on.
502 - Bad Gateway. httpd is trying to forward to an non-running Tomcat
503 - Application not available. httpd has forwarded to Tomact, but Tomcat can't provide the application - typically it's not running.
500 - Internal server error. Your httpd forwarding isn't configured right?
3. When doing a fresh restart of Tomcat with a major upgrade of applications, or after a series of tests that have generated a confusing array of intermediate files that could get carried over to the live application, you can
delete the work and temp subdirectories in Tomcat. But, please, only do this when Tomcat is stopped!
(written 2006-12-24 08:43:10)
Associated topics are indexed under
A653 - Web Application Deployment - Tomcat - Configuring Web ApplicationsA900 - Web Application Deployment - Tomcat - Extra Features
Some other Articles
Dates, times, clickable diarys in PHPPassing GET parameters through Apache mod_rewriteDate conversion - PHPFriends and familyApache httpd and Apache Tomcat together tipsStirling at nightOld dog, old tricksRoom at the Inn, Guy at the stationMeet the neighbours.pdf files - upload via PHP, store in MySQL, retrieve