https和http的区别
https的对称加密,传输信息的加密的过程。
配置步骤:
tomcat的配置代码:
<Connector port="443"
protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
keystoreFile="C:/apache-tomcat-8.0.41/cert/214013111460279.pfx"
keystoreType="PKCS12"
keystorePass="214013111460279"
sslEnabledProtocols="TLSv1"
clientAuth="false" sslProtocol="TLS" />
2.访问http自动转换成https:
tomcat的web.xml的代码配置
(代码部分有待参考:)
<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>
<security-constraint>
<web-resource-collection>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint></auth-constraint>
</security-constraint>
3.为了保证跳转成功:
把server.xml文件中的所有的的8443端口改成443端口,强制跳转时用到