tomcat如何配置https

2025-04-27 11:32:22

1、打开命令行或者win+r,输入cmd,打开命令行

tomcat如何配置https

2、之后,使用jdk提供的keytool命令生成证书,具体命筠沭鱿漆令如下:keytool -genkey -alias "tomcat" -keyalg &qu泠贾高框ot;RSA" -keystore "d:\data\test.keystore"

tomcat如何配置https

3、之后输入kestore的密码,需要输入两次

tomcat如何配置https

4、然后,需要你输入城市、省份、国家的名称,这个可以随便填写,按回车

tomcat如何配置https

5、之后会把信息都打印出来,让你确认信息,输入y,按回车

tomcat如何配置https

6、然后要求我们输入tomcat的主密码,我们设置跟keystore相同,按回车

tomcat如何配置https

7、好了,我们的证书生成好了,去主目录看一下吧,test.keystore

tomcat如何配置https

8、打开tomcat根目录下的conf/server.xml,在service标签下添加一个connector标签:<Connect泠贾高框or port="443" protocol="org.apache.coyote.http11.Http11Protocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="D:\Program Files (x86)\eclipse\Git\eclipse\apache-tomcat-7.0.64\key\test.keystore" keystorePass="tomcat" ciphers="tomcat"/>。然后将另外两个默认的协议的重定向到443端口,保存

tomcat如何配置https
tomcat如何配置https
tomcat如何配置https

9、打开本目录下的web.xml,在<嘛术铹砾web-app>便签的在底端新增一段配置,配置内容如下:<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如何配置https

10、好了,现在启动tomcat,畅快的使用https

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢