1.
在conf/server.xml中配置
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="D:\tomcat\apache-tomcat-9.0.37\conf\test.keystore"
type="RSA" certificateKeystorePassword="a123456" />
</SSLHostConfig>
</Connector>
certificateKeystoreFile:证书路径
certificateKeystorePassword:证书密码
2.配置http转https,在tomcat中的conf/web.xml 最后面
<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>