JSP / Tomcat / Apache setup overview on Fedora Core

For someone with so much Java experience, boy do I feel clueless - thanks in advance for your help in my grocking the present (Feb, 2010) JSP environment.

Here's what I am hoping to learn:

  • Do I understand correctly that most people use Apache to "front-end" their Tomcat servers, such that Apache "talks" directly to web clients and "proxies" Tomcat servers?
  • Do I understand correctly that Apache isn't capable of serving JSP directly but requires a server (like Tomcat)?
  • Is there an RPM package for Fedora Core so I don't have to build one myself? Or, does Fedora Core's package installer do a good job on this one from source code? (Some do, some don't!)

While I'm here asking questions; Does Tomcat come with a working example that one can start hacking on as a way to get started quickly? If not, got a good suggestion?

Thanks folks, RT


Solution 1:

Yes, most often Tomcat is chained to a webserver such as httpd, communicating via the ajp protocol. httpd is not capable of functioning as a servlet container and compiling JSP's, but Tomcat has poor performance serving static content (such as images) over HTTP. By chaining the two together, you get the best of both worlds. For development, most people don't care too much about Tomcat's static content performance so they go directly to port 8080.

For development on Fedora (if you want to test fronting Tomcat):

  • install the httpd package
  • install the tomcat6 package
  • Edit /etc/httpd/conf.d/proxy_ajp.conf and uncomment/create an appropriate ProxyPass line
  • Drop your .war into /var/lib/tomcat6/webapps/

For production on Fedora:

  • install httpd and tomcat6 packages
  • install mod_jk (you may need to download and compile this from the Tomcat website)
  • configure mod_jk per its documentation

(YMMV on whether Fedora's upgrade cycle is too quick for a production server)