JavaWeb项目配置https安全链接
如图第一步:
会在用户目录下生成一个文件: .keystore
如图第五步:
在Tomcat的配置文件server.xml中加入标签
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="C:/Users/Administrator/.keystore(秘钥文件.keystore的路径)"
keystorePass="(秘钥文件密码)"/>
若想强制浏览器链接为https,需要在web项目的web.xml文件中配置一个标签
<!-- 强制浏览器使用https安全连接 -->
<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>