感謝文章http://blog.csdn.net/zhangzuomian/article/details/50324395
但未測試過,先記錄下
大致分2步:1、獲取證書。2、修改tomcat的config/server.xml和項目中web.xml配置
打開config/server.xml,取消下面8443端口代碼的注釋,並修改如下:
<Connector port="8443"protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false"keystoreFile="D:/AppServer/Tomcat/apache-tomcat-6.0.32/conf/tomcat.keystore" keystorePass="deleiguo" sslProtocol="TLS" />
注:
keystoreFile:證書文件的位置,keystorePass 是keystore的密碼(你在生成證書的時候,會有的keystore密碼和tomcat主密碼)
項目中web.xml添加如下:、
<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>
轉載自http://blog.csdn.net/rainyspring4540/article/details/68925073