Tomcat7 configure https

Source: Internet
Author: User

Step 1: generate the. keystore File
% Java_home % keytool-genkey-alias tomcat-keyalg RSA-keystore my. keystore
Step 2: Modify the Tomcat server. xml file
Copy the generated tomcat. keystore file to the conf folder of Tomcat, which is in the same path as the server. xml file,

<Connector
Port = "8443" maxthreads = "200"
Scheme = "HTTPS" secure = "true" sslenabled = "true"
Keystorefile = "./CONF/mytomcat. keystore" keystorepass = "123qew"
Clientauth = "false" sslprotocol = "TLS"/>
Among them, 123qwe is the password set when generating my. keystore. If you only want to Use https access, You Need To comment out the original 8080 window listener.
<! -- Connector Port = "8080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443"/-->

Recently, we found that the same configuration is as follows ]:

 

<Connector Port = "8080" protocol = "HTTP/1.1" sslenabled = "true"

Maxthreads = "150" Scheme = "HTTPS" secure = "true"

Clientauth = "false" sslprotocol = "TLS" keystorefile = "./CONF/tomcat. keystore" keystorepass = "123qwe"/>

The solution is normal under tomcat-7.0.27 and abnormal under tomcat-7.0.23.

 

 

 

<Connector Port = "8080" protocol = "org. Apache. Coyote. http11.http11protocol" sslenabled = "true"

Maxthreads = "150" Scheme = "HTTPS" secure = "true"

Clientauth = "false" sslprotocol = "TLS" keystorefile = "./CONF/tomcat. keystore" keystorepass = "123qwe"/>

 

 

The reason for the introduction of APR is that the connector configuration has a subtle relationship with whether APR is supported. The following connector configuration will go wrong when APR is supported!

The configuration in Tomcat-6 and tomcat-7.0.23 enables the connector instance to load the org. Apache. Coyote. http11.http11aprprotocol protocol processor, while http11aprprotocol does not have the keystorefile attribute. Therefore, an error is reported during startup! Therefore, the recommended connector configuration: Protocol = "org. Apache. Coyote. http11.http11protocol"
Or protocol = "org. Apache. Coyote. http11.http11aprprotocol.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.