What should Apache serve and what should Tomcat serve?

眉间皱痕 提交于 2019-12-19 14:07:32

问题


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:


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



来源:https://stackoverflow.com/questions/2330780/what-should-apache-serve-and-what-should-tomcat-serve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!