window环境下tomcat配置https

时间:2022-01-13 19:14:46

jdk1.7+tomcat7


  • 创建证书
keytool -genkey -alias wsria -keyalg RSA -keystore f:/ssl/test

window环境下tomcat配置https

  • 导出证书
keytool -export -file f:/ssl/test.crt -alias wsria -keystore f:/ssl/test

ps.如果提示密码错误,则试一下密码:changeit

  • 导入证书
keytool -import -keystore D:\Java\jdk1.7.0_21\jre\lib\security\cacerts -file f:/ssl/test.crt -alias wsria
  • 查看证书
keytool -list -alias wsria -keystore "%JAVA_HOME%/jre/lib/security/cacerts" -storepass changeit

window环境下tomcat配置https

  • 删除证书
 keytool -delete -alias wsria -keystore "%JAVA_HOME%/jre/lib/security/cacerts" -storepass changeit
  • 配置tomcat

conf/server.xml文件中,本来这些代码是注释的,取消注释,并且引入证书

<Connector port="8443"
protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150"
SSLEnabled="true"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS"
keystoreFile="E:/ssl/test"
keystorePass="tomcat"/>
  • 启动服务
    window环境下tomcat配置https

如此则配置成功,欢迎讨论,QQ:467507176