带有 APR 的 Tomcat 仍然说 aprConnector 是假的 [英] Tomcat with APR still says aprConnector is false

查看:76
本文介绍了带有 APR 的 Tomcat 仍然说 aprConnector 是假的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 server.xml 中的连接器:

此连接器的目标是通过 HTTP2 和 APR 以及 HTTPS 提高速度.

我们使用操作系统包 tomcat-native 安装了 tomcat native.

启动时的日志输出:

<块引用>

信息 [主要]org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 已加载基于 APR 的 Apache Tomcat Native 库 [1.2.16] 使用 APR 版本[1.6.3].

信息 [主要]org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR功能:IPv6 [真]、发送文件 [真]、接受过滤器 [假]、随机 [真].

信息 [主要]org.apache.catalina.core.AprLifecycleListener.lifecycleEventAPR/OpenSSL 配置:useAprConnector [false],useOpenSSL [true]

一切看起来都很棒,除了 useAprConnector [false]

那么 APR 真的在做什么吗?

我在相关文档中找不到任何内容:

https://tomcat.apache.org/tomcat-8.0-doc/config/http.html#SSL_Support

https://tomcat.apache.org/tomcat-8.0-doc/apr.html

解决方案

Tomcat 8.5 当前的默认设置是使用 Java NIO 连接器和 OpenSSL 作为加密引擎.libtcnative 仍然是必需的,它需要 libapr,但没有使用APR 连接器"本身.

这意味着 Tomcat 使用带有 OpenSSL 引擎的纯 Java 连接器进行加密.您可以享受 OpenSSL 的速度优势,而不会受到 APR 连接器本身的一些缺点.

IMO 这是您可以使用的最佳配置选项,因此除非您有明确的理由明确使用 APR 连接器,否则您应该保留它.

如果你真的想使用APR连接器,那么你需要设置useAprConnector 在您的 AprLifecycleListener 上的属性设置为 true.>

This is the connector in server.xml:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150"
               SSLEnabled="true"
               scheme="https"
               compression="off"
               connectionTimeout="1190"
               address="0.0.0.0"
               >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="/etc/ssl/certs/private.key"
                         certificateFile="/etc/ssl/certs/public.pem"
                          />
        </SSLHostConfig>
</Connector>

The goal with this connector is speed with HTTP2 and APR, along with HTTPS.

We installed tomcat native using the OS package tomcat-native.

Log output on startup:

INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.16] using APR version [1.6.3].

INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]

Everything looks great, except for the useAprConnector [false]

So is APR actually doing anything?

I can't find anything in the relevant documentation:

https://tomcat.apache.org/tomcat-8.0-doc/config/http.html#SSL_Support

https://tomcat.apache.org/tomcat-8.0-doc/apr.html

解决方案

The current default in Tomcat 8.5 is to use the Java NIO connector with OpenSSL as the crypto engine. libtcnative is still required, which requires libapr, but the "APR Connector" itself is not being used.

That means that Tomcat is using a pure-Java connector with the OpenSSL engine for crypto. You get the benefits of OpenSSL's speed without some of the downsides of the APR connector itself.

IMO this is the best configuration option available to you, so you should leave it unless you have a compelling reason to use the APR connector explicitly.

If you really want to use the APR connector, then you will need to set the useAprConnector attribute on your AprLifecycleListener to true.

这篇关于带有 APR 的 Tomcat 仍然说 aprConnector 是假的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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