标题证书文件一般:

这里进入nginx文件一个crt文件,一个key文件

1.使用openssl
openssl pkcs12 -export -in server.crt -inkey server.key -out mycert.p12 -name abc -CAfile myCA.crt
之后提示输入密码回车生成keysrore文件
2.将keystore转换成p12的jks证书
keytool -importkeystore -v -srckeystore mycert.p12 -srcstoretype pkcs12 -srcstorepass a123456 -destkeystore Aserver.keystore -deststoretype jks -deststorepass b123456
最后生成.p12文件
在springboot,application.yml中:

配置好证书信息,最后打包成jar包,将证书和jar包放在同级目录就可以使用了
前端是配置在https中的,原本使用的http访问的验证码模块图片变成了https

并且无法访问,将接口单独访问显示:

原因是:后端服务必须放在证书域名配置的服务器上面,前端再通过https:域名:端口访问
就好了
本文详细介绍了如何使用openssl处理crt和key文件,将keystore转换为p12格式,并在SpringBoot应用中配置HTTPS证书。重点在于解决前端https访问问题,确保后端与证书域名匹配。

570

被折叠的 条评论
为什么被折叠?



