Windows environment and configuring Tomcat APR open http / 2.0 access

1, http / 2.0 need to turn on https

  Reference: https://www.cnblogs.com/zhi-leaf/p/11978615.html

2, download tcnative-1.dll file

  Download the official website: https://tomcat.apache.org/download-native.cgi

3, unzip the file, copy the x64 / tcnative-1.dll to the C: \ Windows \ System32 directory

4, modify the server.xml file in the $ TOMCAT_HOME / conf directory, increase the allocation

 5, the following log output after starting tomcat

6, using the Firefox browser to access tomcat, we found http version has been changed to http / 2.0 of

 

 

Remarks:

1, when the protocol used org.apache.coyote.http11.Http11NioProtocol, and the operating system supports On Apr, then tomcat automatically use OpenSSL, the following code:

2, when the protocol used org.apache.coyote.http11.Http11NioProtocol, and using jdk jdk8 above, you may be arranged <UpgradeProtocol className = "org.apache.coyote.http2.Http2Protocol" / >, the use of http / 2.0. jdk8.x not supported by default ALPN (Application Layer Protocol Negotiation, application layer protocol negotiation), there is no support apr can not be realized http / 2.0, jetty has its own ALPN implementation packages, not to be more than jdk8 limit .

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
    <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
    <SSLHostConfig>
        <Certificate certificateKeyFile="conf/localhost.key"
                     certificateFile="conf/localhost.crt"
                     type="RSA" />
    </SSLHostConfig>
</Connector>

 

Guess you like

Origin www.cnblogs.com/zhi-leaf/p/11991009.html