zl程序教程

您现在的位置是:首页 >  工具

当前栏目

tomcat 配置pfx证书

Tomcat配置 证书 pfx
2023-06-13 09:11:18 时间

大家好,又见面了,我是你们的朋友全栈君。

server.xml

tomcat根目录创建cert文件夹,把文件xx.pfx文件放进去

<Connector port=”80″ protocol=”HTTP/1.1″ connectionTimeout=”20000″ redirectPort=”443″ URIEncoding=”UTF-8″ />

<Connector port=”443″ protocol=”org.apache.coyote.http11.Http11Protocol” maxThreads=”150″ SSLEnabled=”true” scheme=”https” secure=”true” clientAuth=”false” sslProtocol=”TLS” keystoreFile=”cert/xxx.pfx” keystorePass=”密码” />

这个时候已经可以使用https访问了,但是你通过非https访问页想跳转到https就需要

再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>

perfect

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/136731.html原文链接:https://javaforall.cn