注册域名

这里是因为国内的ip不能注册免费域名,如何可以,请使用科学上网
修改到DNSPod域名服务器


获得密钥

保存ID和Token
在.bash_rc中注册全局变量
1 2
| export DP_Id="123" export DP_Key="abc"
|
先注册,再生成证书,使用DNS方式
1 2 3 4 5 6
| curl https://get.acme.sh | sh //注册账户 acme.sh --register-account -m divint3@gmail.com
acme.sh --issue --dns dns_dp -d "divint3.cf" -d "*.divint3.cf"
|
我们可以在这里

可以找到证书

在这里

转换指令(转换为pkcs12证书)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| openssl pkcs12 -export \ -in fullchain.cer \ -inkey divint3.cf.key \ -out keystore.p12 \ -name tomcat \ -CAfile ca.cer \ -caname root
openssl pkcs12 -export \ -in fullchain.cer \ -inkey divint3.cf.key \ -out keystore.p12 \ -name tomcat
|
application.yaml配置ssl访问
1 2 3 4 5 6 7 8 9
| server: port: 8082 ssl: key-store: classpath:keystore.p12 key-store-type: PKCS12 key-store-password: 200214
security: require-ssl=true: true
|
参考
Let's Encrypt 证书申请及配置 - 简书 (jianshu.com)
HTTPS证书文件格式转换_phris的博客-CSDN博客
在Spring Boot中配置ssl证书实现https - 简书 (jianshu.com)
让我们加密保护的Spring Boot | 码农家园 (codenong.com)
API 密钥 - DNSPod-免费智能DNS解析服务商-电信_网通_教育网,智能DNS
Linux 下使用acme.sh生成Let's Encrypt泛域名免费证书 - 简书 (jianshu.com)