Tomcat配置之Https

为了小绿锁


好吧扯远了..我使用的是
Symantec Basic DV
这里推荐下小鸟云的证书
Let's Encrypt 一款免费的国外ssl
1块钱一年经济又实惠


本案例是基于JAVA做的下面有转换工具
腾讯云的在线文档
证书格式转换
cer+key+私钥=jks

server.xml

<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" keystoreFile="conf/xxx.jks" keystorePass="xxx私钥"  clientAuth="false" sslProtocol="TLS" /> 

web.xml

<!--</web-app>之前-->
<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>

猜你喜欢

转载自blog.csdn.net/qq_33981438/article/details/80544990