购买免费证书:https://common-buy.aliyun.com/?commodityCode=cas#/buy
下载安装严格按照阿里云官网 主要说明下tomcat配置需要注意的
conf下的server.xml 配置 (80 http默认 443https默认)
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="cert/xxx.jks" keystorePass="xxxxx"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="443" />
输入https://www.xxx.com 即可访问,不带端口号
conf下的web.xml修改
1 <welcome-file-list> 2 <welcome-file>index.html</welcome-file> 3 <welcome-file>index.htm</welcome-file> 4 <welcome-file>index.jsp</welcome-file> 5 </welcome-file-list> 6 7 <login-config> 8 <!-- Authorization setting for SSL --> 9 <auth-method>CLIENT-CERT</auth-method> 10 <realm-name>Client Cert Users-only Area</realm-name> 11 </login-config> 12 13 <security-constraint> 14 <!-- Authorization setting for SSL --> 15 <web-resource-collection > 16 <web-resource-name >SSL</web-resource-name> 17 <url-pattern>/*</url-pattern> 18 </web-resource-collection> 19 <user-data-constraint> 20 <transport-guarantee>CONFIDENTIAL</transport-guarantee> 21 </user-data-constraint> 22 </security-constraint>
输入域名或者http://强制跳转到https://服务