apache 到 tomcat:mod_jk 与 mod_proxy

发布于 2024-07-26 07:27:41 字数 163 浏览 11 评论 0原文

使用 mod_jkmod_proxy 为 apache 提供 tomcat 实例的优点和缺点是什么?

我多年来一直在生产中使用 mod_jk,但我听说这是前端 tomcat 的“旧方法”。 我应该考虑改变吗? 会有什么好处吗?

What are the advantages and disadvantages of using mod_jk and mod_proxy for fronting a tomcat instance with apache?

I've been using mod_jk in production for years but I've heard that it's "the old way" of fronting tomcat. Should I consider changing? Would there be any benefits?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

乱了心跳 2024-08-02 07:27:41

这些模块的优缺点比较位于 < a href="http://blog.jboss.org/" rel="noreferrer">http://blog.jboss.org/

mod_proxy

* Pros:
      o No need for a separate module compilation and maintenance. mod_proxy,
        mod_proxy_http, mod_proxy_ajp and mod_proxy_balancer comes as part of 
        standard Apache 2.2+ distribution
      o Ability to use http https or AJP protocols, even within the same 
        balancer.
* Cons:
      o mod_proxy_ajp does not support large 8K+ packet sizes.
      o Basic load balancer
      o Does not support Domain model clustering

mod_jk

* Pros:
      o Advanced load balancer
      o Advanced node failure detection
      o Support for large AJP packet sizes
* Cons:
      o Need to build and maintain a separate module

A pros/cons comparison for those modules exists on http://blog.jboss.org/

mod_proxy

* Pros:
      o No need for a separate module compilation and maintenance. mod_proxy,
        mod_proxy_http, mod_proxy_ajp and mod_proxy_balancer comes as part of 
        standard Apache 2.2+ distribution
      o Ability to use http https or AJP protocols, even within the same 
        balancer.
* Cons:
      o mod_proxy_ajp does not support large 8K+ packet sizes.
      o Basic load balancer
      o Does not support Domain model clustering

mod_jk

* Pros:
      o Advanced load balancer
      o Advanced node failure detection
      o Support for large AJP packet sizes
* Cons:
      o Need to build and maintain a separate module
岁月静好 2024-08-02 07:27:41

如果您想留在 Apache 土地上,您也可以尝试较新的 mod_proxy_ajp,它使用 AJP 协议而不是普通的旧 HTTP 与 Tomcat 通信,但它利用 mod_proxy 来完成工作。

If you wish to stay in Apache land, you can also try the newer mod_proxy_ajp, which uses the AJP protocol to communicate with Tomcat instead of plain old HTTP, but which leverages mod_proxy to do the work.

野の 2024-08-02 07:27:41

AJP 与 HTTP

当使用 mod_jk 时,您正在使用 AJP。 使用 mod_proxy 时,您将使用 HTTPHTTPS。 这本质上就是造成所有差异的原因。

Apache JServ 协议 (AJP)

Apache JServ 协议 (AJP) 是一种二进制协议,可以将来自 Web 服务器的入站请求代理到位于 Web 服务器后面的应用程序服务器。 AJP 是一种高度可信的协议,永远不应该暴露给不受信任的客户端,这些客户端可能会使用它来访问敏感信息或在应用程序服务器上执行代码。

优点

  • 易于设置,因为不需要正确转发 HTTP 标头。
  • 它占用的资源较少,因为 TCP 数据包以二进制格式转发,而不是进行成本高昂的 HTTP 交换。

缺点

  • 传输的数据未加密。 它只能在受信任的网络中使用。

超文本传输​​协议 (HTTP)

HTTP 在客户端-服务器计算模型中充当请求-响应协议。 例如,网络浏览器可以是客户端,而在托管网站的计算机上运行的应用程序可以是服务器。 客户端向服务器提交HTTP请求消息。 服务器代表客户端提供HTML文件和其他内容等资源,或者执行其他功能,并向客户端返回响应消息。 响应包含有关请求的完成状态信息,并且还可能在其消息正文中包含请求的内容。

优点

  • 可以使用 SSL/TLS 加密,使其适合跨不受信任网络的流量。
  • 它很灵活,因为它允许在转发之前修改请求。 例如,设置自定义标题。

缺点

  • 由于必须确保 HTTP 标头的正确转发,因此开销更大。
  • 由于请求在转发之前已被完全解析,因此资源消耗更大。

AJP vs HTTP

When using mod_jk, you are using the AJP. When using mod_proxy you will use HTTP or HTTPS. And this is essentially what makes all the difference.

The Apache JServ Protocol (AJP)

The Apache JServ Protocol (AJP) is a binary protocol that can proxy inbound requests from a web server through to an application server that sits behind the web server. AJP is a highly trusted protocol and should never be exposed to untrusted clients, which could use it to gain access to sensitive information or execute code on the application server.

Pros

  • Easy to set up as the correct forwarding of HTTP headers is not required.
  • It is less resource intensive because the TCP packets are forwarded in binary format instead of doing a costly HTTP exchange.

Cons

  • Transferred data is not encrypted. It should only be used within trusted networks.

Hypertext Transfer Protocol (HTTP)

HTTP functions as a request–response protocol in the client–server computing model. A web browser, for example, may be the client and an application running on a computer hosting a website may be the server. The client submits an HTTP request message to the server. The server, which provides resources such as HTML files and other content, or performs other functions on behalf of the client, returns a response message to the client. The response contains completion status information about the request and may also contain requested content in its message body.

Pros

  • Can be encrypted with SSL/TLS making it suitable for traffic across untrusted networks.
  • It is flexible as it allows to modify the request before forwarding. For example, setting custom headers.

Cons

  • More overhead as the correct forwarding of the HTTP headers has to be ensured.
  • More resource intensive as the request is fully parsed before forwarding.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文