前述

目前市面上的证书都90天了,而且都是单域名。之前博主写过 Joyssl 是可以使用泛域名的。但好景不长,现在Joy SSL改成30天了,太频繁了。

最近研究了Let's 的,用certboot来申请泛域名,整体使用不从,也将整个实践记录分享,希望能帮助到有需要的朋友。
2024-10-22T05:57:50.png

部署

  • 系统

    dnf config-manager --set-enabled CRB && dnf clean all && dnf makecache
    
    ## 9系列
    dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm   https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm
    
    ## 8系列
    dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-8.noarch.rpm
    
    ## 安装 certboot
    dnf install -y certbot python3-certbot-nginx
    
  • certbot
    申请 SSL证书,主域名和泛域名一定要写两个(如一个主域名 + 一个泛域名),不然会导致主域名无法访问
    certbot certonly --preferred-challenges dns --manual -d your_domains -d *.your_domains --server https://acme-v02.api.letsencrypt.org/directory
  • 按照提示填写,如图
    2024-10-21T13:15:33.png
  • 等待出现填写dns记录后,不要按回车,要等dns解析出来后再回车,否则会失败,得重新来,这里可以使用 dig -t txt your_domains 来查询,当然也可以使用 ITdog 等在线工具检测。
    2024-10-21T13:18:39.png
    2024-10-22T02:39:05.png
  • 查看证书

    certbot certificates

    2024-10-21T14:02:27.png
    2024-10-21T14:01:36.png

  • 使用证书
    由于certboot 生成的证书默认在 /etc/letsencrypt/live 下,需要需要手动配置一下;如果你的nginx配置证书路径,那么直接做个软连接即可。

    ## 公钥
    ln -s /etc/letsencrypt/live/your_domins/fullchain.pem  你的证书绝对路径 (nginx 配置的)
    
    ## key
    ln -s /etc/letsencrypt/live/your_domins/privkey.pem  你的证书绝对路径(nginx 配置的)
  • 验证配置

    ## 检查nginx 配置
    nginx -t
    
    ## 生效配置
    nginx -s reload
  • 如果你用了cdn,那么同时也需要将证书更新到对应的cdn中。

「 希望熬过一切,星光璀璨 」

流年小站,感谢有您的支持

「 道路坎坷,感谢有您 ---来自 anYun 的感谢 」

使用微信扫描二维码完成支付

2024-10-22
已阅:3 人/次

 
 
 
分享是一种美德 x
打开微信,右上角的"+"选择"扫一扫"
使用“扫一扫”将博文分享至朋友圈吧

本文由 anYun 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。
我的博客即将同步至腾讯云开发者社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=3oibnoh9lo6cs

还不快抢沙发

添加新评论

Myssl安全认证