CentOS7.X生成免费SSL通配符证书

安装前的准备

  1. 原文地址https://note.so1234.top
  2. 查看python版本(要求版本大于2.7.0)

    python -V
  3. 如果python版本低于2.7.0建议不要随意更新python,会影响yum的正常使用
  4. 安装库支持

    yum install yum-utils -y
    
    yum-config-manager \
    --enable \
    rhui-REGION-rhel-server-extras \
    rhui-REGION-rhel-server-optional \
  5. 安装certbot-nginx

    cd /root
    wget https://dl.eff.org/certbot-auto
    cp /root/certbot-auto /usr/local/bin/
    chmod -R 755 /usr/local/bin/certbot-auto
  6. 生成证书(*.xxx.com为通配符域名)

    certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d "*.xxx.com" -d "xxx.com" --manual --preferred-challenges dns-01 certonly
    # 1.执行过程中输入邮箱
    # 2.执行过程中输入A同意
    # 3.执行过程中输入Y确认
    # 4.执行过程中输入Y确认
    # 5.执行过程中添加DNS的TXT解析记录,以阿里云DNS为例
        # 1.记录类型TXT
        # 1.主机记录_xxx-xxx.xxx.com
        # 1.解析线路默认
        # 1.记录值xxxxxx
        # 1.TTL 10分钟
    # 6.按下回车,提示成功!
  7. 按照成功后的提示,记下证书文件的路径,提示信息类似如下

    IMPORTANT NOTES:
     - Congratulations! Your certificate and chain have been saved at:
       /etc/letsencrypt/live/xxx.com/fullchain.pem
       Your key file has been saved at:
       /etc/letsencrypt/live/xxx.com/privkey.pem
       Your cert will expire on 2xxx-xx-xx. To obtain a new or tweaked
       version of this certificate in the future, simply run certbot-auto
       again. To non-interactively renew *all* of your certificates, run
       "certbot-auto renew"
     - If you like Certbot, please consider supporting our work by:
       Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
       Donating to EFF:                    https://eff.org/donate-le
    
    # 生成的文件放在:
    /etc/letsencrypt/live/xxx.com/fullchain.pem
    /etc/letsencrypt/live/xxx.com/privkey.pem
    # 该证书到期的时间是
    2xxx-xx-xx
    # 所以要设置自动更新证书
  8. 自动更新

    # 测试是否支持自动更新
    certbot-auto renew --dry-run
    # 使用自动更新
    certbot-auto renew
    # 在crontab配置:每5天尝试自动更新(频率小于90天即可)
    crontab -e
    0 0 */5 * * root -c certbot-auto renew
    ESC
    :wq
  9. 配置nginx
  10. 完成
  11. 领支付宝红包支持作者

    扫码领支付宝红包

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值