码迷,mamicode.com
首页 > Web开发 > 详细

tomcat配置https

时间:2016-01-18 20:41:54      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:

1、开启使用https协议

编辑tomcat目录下的conf/server.xml文件

<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150"
scheme="https"secure="true"clientAuth="false" sslProtocol="TLS"
keystoreFile="keystore/SSL.jks" keystorePass="XXXX" />

keystoreFile:证书路径(相对与tomcat主目录,例如:conf/SSL.jks)

keystorePass:证书密码

2、强制使用https协议

tomcat主目录的 conf/web.xml 中的 </welcome- file-list>节点后面加上这

 <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>  

 

tomcat配置https

标签:

原文地址:http://www.cnblogs.com/anai/p/5140232.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!