First, generate certificate step
Second, configure the Tomcat server
(1) Modify the $CATALINA _home/conf/server.xml file as follows:
<connector port= "protocol=" http/1.1 "connectiontimeout=" 20000 "redirectport=" 443 "executor=" TomcatThreadPoo L "enablelookups=" false "usebodyencodingforuri=" true "uriencoding=" Utf-8 "compression=" on "Compre Ssionminsize= "2048" nocompressionuseragents= "Gozilla,traviata" compressablemimetype= "Text/html,text/xml,text/jav Ascript,text/css,text/plain "/>
(2) Remove comments and modify parameters
<connector port= "443" protocol= "Org.apache.coyote.http11.Http11Protocol" sslenabled= "true" maxthreads= "150" Scheme= "https" secure= "true" clientauth= "Want" sslprotocol= "TLS" keystorefile= "D:/tomcat.keystore" keystorepass= "123456" truststorefile= "D:/tomcat.keystore" truststorepass= "123456"/>
Note: Keystorefile, Keystorepass, Truststorefile, Truststorepass are the location and password of the certificate file, which are set during the certificate file generation process.
(3) Modifying parameters
<connector port= "8009" protocol= "ajp/1.3" redirectport= "443"/>
(4) Force HTTPS access: Open $catalina_home/conf/web.xml, or add the following to the Web. XML of the project file:
<login-config><!--Authorization setting for SSL--><auth-method>client-cert</auth-method> <realm-name>client Cert users-only area</realm-name></login-config><security-constraint> <!--Authorization setting for SSL--><web-resource-collection><web-resource-name >ssl</ web-resource-name><url-pattern>/*</url-pattern></web-resource-collection>< user-data-constraint><transport-guarantee>confidential</transport-guarantee></ User-data-constraint></security-constraint>
After the above configuration is complete, you can use SSL after rebooting tomcat. The IE Address bar can be entered directly into the address do not have to enter "http:/" or "https://", you can also enter "http://" Will jump to "https://" to log in.
Tomcat to configure HTTPS and access HTTP to automatically jump to HTTPS