6.2. 为连接器启用 HTTP/2
您可以通过更新 server.xml 配置文件中的设置来为连接器启用 HTTP/2。
步骤
-
打开
JWS_HOME/tomcat/conf/server.xml配置文件。 在
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>要应用配置更新,以 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 不再被支持,之后从文档中删除了。