章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • 随笔

  • 面试

  • 工具

    • vpn

      • 企业级openvpn搭建
    • mac电脑常用软件
    • 使用这7个谷歌搜索技巧来找到你想要的,老司机必备技巧
    • vuepress配置artalk
    • windows目录实时同步工具
    • vim快捷使用方式
    • 常用操作
    • jetbrains最新版2022.2.2全系列激活教程
    • chagpt工具使用和总结
    • acme.sh使用 cloudflare dns 生成证书
      • cursor使用方式介绍
      • AI 编程工具简介
      • MarkText工具优化设置
      • RAR zip压缩包密码破解
    • 美食

    • 生活
    • 工具
    章工运维
    2024-05-24
    目录

    acme.sh使用 cloudflare dns 生成证书

    # 第一步,安装acme

    下载脚本:https://github.com/acmesh-official/acme.sh/archive/refs/tags/3.0.7.tar.gz

    执行一下命令

    tar -xf acme.sh-3.0.7.tar.gz
    cd acme.sh-3.0.7
    sh acme.sh --install
    
    
    1
    2
    3
    4

    # 第二步,配置acme

    去Cloudflare找到你的个人api key,如果没有Cloudflare就去注册一个。

    # 方法A

    首先你需要获取你的Cloudflare Global API Key (opens new window)。访问上面这个链接,然后在API 密钥选项卡中找到Global API Key,点击后面的查看按钮。然后在Shell中执行以下命令,不要忘记替换以下命令行中的部分参数。

    export CF_Key="这里替换为你的Global API Key"
    export CF_Email="这里替换为你的Cloudflare账户的电子邮箱"
    acme.sh --issue --dns dns_cf -d example.com -d '*.example.com'
    
    1
    2
    3

    CF_Key 和 CF_Email 将保存在 ~/.acme.sh/account.conf中,并在下次需要时重复使用。

    DNS API 令牌已成功创建
    xxxxxxxxxxx
    curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
         -H "Authorization: Bearer xxxxxxxxxxx" \
         -H "Content-Type:application/json"
    
    1
    2
    3
    4
    5

    # 方法B

    因为某些原因不想使用Global API Key还可以使用Api Token

    export CF_Token="替换为TOKEN"
    export CF_Account_ID="替换为账户ID"
    
    1
    2

    # 更换ACME.sh的CA为ZeroSSL

    # 注册一个ZeroSSL账户

    传送门:https://app.zerossl.com/signup

    # 获取账户的EAB凭证,用来注册acme帐户

    传送门:Log In - ZeroSSL (opens new window)

    点击生成会生成你的eab-kid和eab-hmac-key,复制保存下来;

    acme.sh  --register-account  --server zerossl \
    
            --eab-kid  你的eab-kid \
    
            --eab-hmac-key  你的eab-hmac-key
    
    1
    2
    3
    4
    5

    # 切换默认CA

    切换acme.sh的默认CA为ZeroSSL

    acme.sh --set-default-ca  --server zerossl
    
    1

    # 申请证书

    # 方式一

    acme.sh --install-cert -d zzppjj.top \
    --key-file /cert/zzppjj.top.key  \
    --fullchain-file /cert/zzppjj.top.crt \
    --reloadcmd   "systemctl restart nginx"
    
    1
    2
    3
    4

    # 方式二

    acme.sh --install-cert -d lushihuan.com \
    --cert-file      /usr/local/nginx/ssl/cert.pem  \
    --key-file       /usr/local/nginx/ssl/key.pem  \
    --fullchain-file /usr/local/nginx/ssl/fullchain.pem  \
    --reloadcmd   "systemctl restart nginx"
    
    1
    2
    3
    4
    5
    微信 支付宝
    上次更新: 2024/11/27, 09:14:35

    ← chagpt工具使用和总结 cursor使用方式介绍→

    最近更新
    01
    shell脚本模块集合
    05-13
    02
    生活小技巧(认知版)
    04-29
    03
    生活小技巧(防骗版)
    04-29
    更多文章>
    Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式