为什么Glassfish的或Tomcat前面使用Apache Web服务器? [英] Why use Apache Web Server in front of Glassfish or Tomcat?

查看:219
本文介绍了为什么Glassfish的或Tomcat前面使用Apache Web服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它是在GF或Tomcat前面使用Apache服务器好主意吗?它提高了性能/安全性?

Is it good idea to use Apache Webserver in front of GF or Tomcat? Does it improve the performance/security?

还是没有任何理由使用的Apache Web服务器与GF?

Or there is not any reason to use Apache Web Server with GF?

推荐答案

从<一个拍摄href=\"http://wiki.apache.org/tomcat/FAQ/Connectors#Q3\">http://wiki.apache.org/tomcat/FAQ/Connectors#Q3


  • 集群。通过使用的Apache HTTP作为前端就可以让的Apache HTTP充当前门你的内容多的Apache Tomcat实例。如果你的Apache雄猫之一发生故障,的Apache HTTP忽略它,你的系统管理员可以睡到天亮。如果您使用硬件负载均衡器和Apache Tomcat的集群功能这一点可以忽略不计。

  • 集群/安全。你也可以使用Apache作为前门不同的Apache雄猫不同的URL命名空间(/ APP1 /,/ APP2 /,/ APP3 /或虚拟主机)。然后,阿帕奇雄猫可以在每一个保护区,并从安全的角度来看,你只需要担心的Apache HTTP服务器。从本质上讲,阿帕奇成为一个聪明的代理服务器。

  • 安全。本主题可以动摇一个哪一方法。 Java有安全管理器,而阿帕奇有较大的心理份额和更多的招数在安全性方面。我不会进入这个更详细,但让谷歌成为你的朋友。根据你的情况下,人们可能会优于其他。也请记住,如果你使用Tomcat运行Apache - 你有两个系统的保卫,而不是一个

  • 加载项。在加入CGI,Perl和PHP是很自然的到Apache。它的速度较慢,多为Tomcat的一个杂牌的。的Apache HTTP也有上百个可以随意插入模块。 Apache Tomcat上能有这个能力,但code还没有被写入。

  • 装饰!随着Apache Tomcat上前面的Apache HTTP,您可以执行任何数量的Apache Tomcat不支持或不具有直接的code支持装饰的。例如,mod_headers中,mod_rewrite的,和mod_alias中可用于Apache Tomcat的写的,但为什么推倒重来时的Apache HTTP做得这么好?

  • 速度。的Apache HTTP是在比的Apache Tomcat提供静态内容更快。但是,除非你有一个高流量的网站,这一点是没有用的。但在某些情况下,Apache Tomcat上可能比Apache httpd的速度更快。所以,基准您的网站。 Apache Tomcat上可以使用正确的连接器(APR与SENDFILE启用)当的httpd的速度执行。速度不应该被认为是Apache的httpd和Tomcat的
  • 之间进行选择时的一个因素
  • 插座处理/系统的稳定性。的Apache HTTP具有更好的插座相对于比的Apache Tomcat的错误情况处理。主要原因是Apache Tomcat上必须通过这必须是跨平台​​的JVM中执行所有插座处理。问题是插座优化是一个平台特定的考验。大部分时间java的code是很好,但是当你还掉线,无效数据包,从无效的IP的无效请求轰炸,的Apache HTTP在下降比基于JVM的程序这些错误条件做一个更好的工作。 (因人而异)

  • Clustering. By using Apache HTTP as a front end you can let Apache HTTP act as a front door to your content to multiple Apache Tomcat instances. If one of your Apache Tomcats fails, Apache HTTP ignores it and your Sysadmin can sleep through the night. This point could be ignored if you use a hardware loadbalancer and Apache Tomcat's clustering capabilities.
  • Clustering/Security. You can also use Apache as a front door to different Apache Tomcats for different URL namespaces (/app1/, /app2/, /app3/, or virtual hosts). The Apache Tomcats can then be each in a protected area and from a security point of view, you only need to worry about the Apache HTTP server. Essentially, Apache becomes a smart proxy server.
  • Security. This topic can sway one either way. Java has the security manager while Apache has a larger mindshare and more tricks with respect to security. I won't go into this in more detail, but let Google be your friend. Depending on your scenario, one might be better than the other. But also keep in mind, if you run Apache with Tomcat - you have two systems to defend, not one.
  • Add-ons. Adding on CGI, perl, PHP is very natural to Apache. Its slower and more of a kludge for Tomcat. Apache HTTP also has hundreds of modules that can be plugged in at will. Apache Tomcat can have this ability, but the code hasn't been written yet.
  • Decorators! With Apache HTTP in front of Apache Tomcat, you can perform any number of decorators that Apache Tomcat doesn't support or doesn't have the immediate code support. For example, mod_headers, mod_rewrite, and mod_alias could be written for Apache Tomcat, but why reinvent the wheel when Apache HTTP has done it so well?
  • Speed. Apache HTTP is faster at serving static content than Apache Tomcat. But unless you have a high traffic site, this point is useless. But in some scenarios, Apache Tomcat can be faster than Apache httpd. So benchmark YOUR site. Apache 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
  • Socket handling/system stability. Apache HTTP has better socket handling with respect to error conditions than Apache Tomcat. The main reason is Apache Tomcat must perform all its socket handling via the JVM which needs to be cross platform. The problem is socket optimization is a platform specific ordeal. Most of the time the java code is fine, but when you are also bombarded with dropped connections, invalid packets, invalid requests from invalid IP's, Apache HTTP does a better job at dropping these error conditions than JVM based program. (YMMV)

这篇关于为什么Glassfish的或Tomcat前面使用Apache Web服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆