1.申请SSL证书,并下载tomcat证书文件
2. 打开conf/server.xml文件进行编辑
1.
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="/www/server/tomcat/conf/***.jks"
keystorePass="****"
clientAuth="false"/>
keystoreFile是证书.jks文件的保存位置,此处是conf目录,如果是其他地址请填写完整目录;
keystorePass是证书密码,在证书申请时填写保存的文件内容
2.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
3.实现http自动跳转到https
后增加以下内容
<security-constraint>
<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>
4.验证
参考地址:https://help.aliyun.com/document_detail/95496.html