1. generate the KeyStore file. keytool-v-genkey-alias tomcat-keyalg rsa-keystore d:/tomcat.keystore-validity 36500
Here Keytool in the JDK bin directory, you can also write an absolute address, where the password is written 123456, the following to use
This generates the Tomcat.keystore
2, Modify the Tomcat/conf/server.xml, and specify the security certificate location and password
<connector port= "443" protocol= "Org.apache.coyote.http11.Http11Protocol" sslenabled= "true" maxthreads= "150 "Scheme=" https "secure=" true " clientauth=" false "sslprotocol=" TLS "keystorefile=" D:/tomcat.keystore " keystorepass= "123456"/>
At this point, both HTTP and HTTPS can access the project, and to completely disable HTTP, you need to modify the following
8080 and 8009 (where the port is changed to 8003) corresponds to 443
<connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "443"/><!-- Define an AJP 1.3 Connector on port 8009-- <connector port= "8003" protocol= "ajp/1.3" redirectport= "443"/>
3. Configure the WEB.XM, and add the following after the Welcome-file-list
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file> index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </ welcome-file-list><login-config><!--Authorization setting for SSL--><auth-method>client-cert </auth-method><realm-name>client Cert user-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>
To disable HTTP unsafe methods, the configuration here can be written like this
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm </welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list><login-con fig><!--Authorization setting for SSL--><auth-method>client-cert</auth-method><realm-name >client Cert user-only area</realm-name> </login-config> <security-constraint><!--Authoriza tion setting for ssl--><web-resource-collection><web-resource-name>ssl</web-resource-name> <url-pattern>/*</url-pattern></web-resource-collection> <user-data-constraint> <tran Sport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constrai Nt> <security-constraint><web-resource-collection><web-resource-name>fortune</ Web-resource-name><url-pattern>/*</url-pattern>
4. Load the project and import the certificate after startup
There is a problem accessing the Https://localhost:443/spfxzd security certificate, right-click
Certificate--Details--Copy to file--next--until export file to desktop file is Tomcat.cer
Here you can double-click the certificate under Install
Open your browser's Internet options below----> content----> Certificates
Select Trusted Root Certification Authorities----> Import certificates
Import the generated certificate in
Complete
Reference configuration: http://www.cnblogs.com/wanghaoyuhappy/p/5267702.html
Tomcat configuration HTTPS