系统版本:Microsoft Windows [版本 10.0.10586]
java版本:Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
tomcat版本:Apache Tomcat/9.0.0.M9
1.从 http://tomcat.apache.org/download-native.cgi下载Native 1.2.8 Windows Binaries zip
32位系统解压文件中的bin/openssl.exe, bin/tcnative-1.dll bin/tcnative-1-src.pdb到{JAVA_HOME}/bin/中
64位系统解压文件中的bin/openssl.exe, bin/x64/tcnative-1.dll bin/x64/tcnative-1-src.pdb到{JAVA_HOME}/bin/中
2.生成证书
openssl genrsa -out server.key 2048
openssl rsa -in server.key -out server.key
openssl req -new -x509 -key server.key -out ca.crt -days 3650
3.修改conf/server.xml
<Connector port="443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="certs/server.key"
certificateFile="certs/ca.crt"
type="RSA" />
</SSLHostConfig>
</Connector>
访问 https://localhost/ 可以看到协议为http2