步骤一:生成证书:
(参见http://mazhihui.iteye.com/blog/1012912);
步骤二:配置Tomcat:
找到%TOMCAT_HOME%/conf/server.xml,配置代码:
<Connector SSLEnabled="true" clientAuth="false" keystoreFile="D:/SSL/server/tomcat.keystore" keystorePass="pdepde" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS" truststoreFile="D:/SSL/server/tomcat.keystore" truststorePass="pdepde"/>
步骤三:配置Web应用:
找到Web应用下的WEB-INF/web.xml,在<welcome-file-list>之后添加配置代码:
<security-constraint> <web-resource-collection> <web-resource-name>shouye</web-resource-name> <url-pattern>/demo.jsp</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
(关于<security-constraint>)