我正在尝试在 Tomcat 前面设置 Apache。 Apache 提供什么服务?我知道 Apache 更适合静态页面和图像。我目前在 Tomcat 中部署了一个 war 文件,其中包含静态页面、图像和 Flash 文件。我应该把这些都放在 Apache 服务器上吗?如何从 Tomcat 应用程序引用这些页面/图像?
我想使用 Apache 来减小 war 文件的大小并希望更快地提供图像。是否有关于设置 Apache 和 Tomcat 以及放置内容的良好指南?
最佳答案
您的 Tomcat 服务器是否存在性能/负载问题?如果您需要(性能、安全性等),请这样做,但如果没有,请不要让事情变得更复杂不需要。
它曾经是在 Tomcat 前端使用 Apache 服务器的标准,但最近版本的 Tomcat 可以(并且经常)用作 HTTP 服务器和 Servlet 容器。
看看 Tomcat Connector FAQ有关该主题的信息。
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
关于apache - Apache应该服务什么,Tomcat应该服务什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4753552/