views:

152

answers:

1

I'm trying to set up Apache in front of Tomcat. What do I have Apache serve? I know Apache works better for static pages and images. I currently deploy a war file in Tomcat that contains static pages, images, and Flash files. Should I put those all on the Apache server? How to I reference those pages/images from the Tomcat application?

I would like to use Apache to decrease the war file size and hopefully serve images faster. Is there a good guide for setting up Apache and Tomcat and what to place where?

+1  A: 

Do you have a problem with performance/load on your Tomcat server? Do it if you need to(performance, security, etc), but don't make things more complicated if you don't need to.

It used to be the standard to front Tomcat with an Apache server, but recent versions of Tomcat can(and often times are) used as both the HTTP Server and the Servlet Container.

Take a look at the Tomcat Connector FAQ for information on the subject.

Why should I integrate Apache with Tomcat? (or not)

There are many reasons to integrate Tomcat with Apache. And there are reasons why it should not be done too. Needless to say, everyone will disagree with the opinions here. With the performance of Tomcat 5 and 6, performance reasons become harder to justify.

...

Speed. Apache is faster at serving static content than Tomcat. But unless you have a high traffic site, this point is useless. But in some scenarios, tomcat can be faster than Apache httpd. So benchmark YOUR site. Tomcat can perform at httpd speeds when using the proper connector (APR with sendFile enabled). Speed should not be considered a factor when choosing between Apache httpd and Tomcat

Mads Hansen
No, I don't have any performance issues (yet) as traffic is low. I thought it was standard practice to front Tomcat with Apache, so I was investigating. What about to reduce the war size (by removing some large images and Flash files)? Is it worth setting up Apache for this reason?
George