申请这里有介绍,我只介绍搭建:
https://yq.aliyun.com/articles/637307?spm=a2c4e.11153940.0.0.17be2b8drZwDeJ
搭建,需要更一个二个配置文件,tomcat/cof 文件夹下 server.xml,web.xml
(1)更新 server.xml ,实现https:
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"
URIEncoding="UTF-8" maxPostSize="20000" maxHttpHeaderSize="8192"/>
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
keystoreFile="conf/**.pfx"
keystoreType="PKCS12"
keystorePass="*****"
sslEnabledProtocols="TLSv1"
clientAuth="false" SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"
SSLCipherSuite="ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4" />
这里解析一下:
8443 是https端口号,如果你没有备案可以选择这个端口,不能使用443;
8080是http端口;
**.pfx是你下载 的tomcat SSL证书,keystorePass,是证书密码;
然后更新web.xml,当有人 访问你的http链接时直接跳转到https
(2) 打开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后即可以使用SSL,IE地址栏中可以直接输入地址 “http://xxxxx:8080” 会自动跳转成为 “https://xxxxx:8443”