6.2. 为连接器启用 HTTP/2


您可以通过更新 server.xml 配置文件中的设置来为连接器启用 HTTP/2。

步骤

  1. 打开 JWS_HOME/tomcat/conf/server.xml 配置文件。
  2. server.xml 文件中,将 HTTP/2 升级协议添加到连接器中。

    例如:

    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="/KeyStore.jks"
                         certificateKeystorePassword="changeit"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

    server.xml 文件包含 APR 协议的一个连接器定义示例,并将升级协议设置为 HTTP/2。

    例如:

    <Connector port="8443"
               protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
  3. 要应用配置更新,以 root 用户身份重启 Red Hat JBoss Web Server。

    • 要使用 systemd 重启 Red Hat Enterprise Linux 上的 JBoss Web Server,请输入以下命令:

      # systemctl restart jws5-tomcat.service
    • 要使用 start .sh 在 Red Hat Enterprise Linux 上重启 JBoss Web Server,请输入以下命令:

      # JWS_HOME/sbin/shudown.sh
      # JWS_HOME/sbin/startup.sh
    • 要在 Microsoft Windows 上重启 JBoss Web Server,请输入以下命令:

      # net restart tomcat9
重要

Red Hat Enterprise Linux 6 不再被支持,之后从文档中删除了。

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部