当前位置: 首页 > news >正文

使用 acme.sh 申请和管理 免费SSL 证书:告别 certbot 的繁琐

使用 acme.sh 申请和管理 SSL 证书:告别 certbot 的繁琐

引言

  • 介绍 SSL 证书的重要性
  • 传统 certbot 的痛点(如 live 目录、复杂的配置)
  • acme.sh 的优势(轻量、灵活、自动化)

一、acme.sh 简介

  1. 什么是 acme.sh
  2. acme.sh 的主要特点
    • 支持多种 DNS 服务商
    • 自动化续期
    • 直接指定证书路径
    • 无需额外依赖

二、安装 acme.sh

  1. 基本安装

    curl https://get.acme.sh | sh -s email=your_email@example.com
    source ~/.bashrc
    
  2. 国内用户安装(解决网络问题)

    git clone https://gitee.com/neilpang/acme.sh.git
    cd acme.sh
    ./acme.sh --install -m your_email@example.com
    source ~/.bashrc
    

三、配置阿里云 DNS

  1. 获取阿里云 AccessKey
  2. 设置环境变量
    export Ali_Key="your_aliyun_access_key"
    export Ali_Secret="your_aliyun_access_secret"
    

四、申请 SSL 证书

  1. 创建证书存放目录

    mkdir -p /www/server/panel/vhost/cert/example.com
    
  2. 申请证书

    acme.sh --issue --dns dns_ali \
      -d example.com \
      -d *.example.com \
      --certpath /www/server/panel/vhost/cert/example.com/cert.pem \
      --keypath /www/server/panel/vhost/cert/example.com/privkey.pem \
      --fullchainpath /www/server/panel/vhost/cert/example.com/fullchain.pem
    

五、配置自动续期

  1. 安装证书并设置自动更新

    acme.sh --install-cert -d example.com \
      --certpath /www/server/panel/vhost/cert/example.com/cert.pem \
      --keypath /www/server/panel/vhost/cert/example.com/privkey.pem \
      --fullchainpath /www/server/panel/vhost/cert/example.com/fullchain.pem \
      --reloadcmd "systemctl reload nginx"
    
  2. 检查自动续期配置

    crontab -l
    

六、Nginx 配置示例nginx

server {
listen 443 ssl;
server_name example.com .example.com;
ssl_certificate /www/server/panel/vhost/cert/example.com/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/example.com/privkey.pem;


七、常见问题解答

  1. 如何查看证书列表?

    acme.sh --list
    
  2. 如何查看证书信息?

    acme.sh --info -d example.com
    
  3. 如何手动续期证书?

    acme.sh --renew -d example.com
    
  4. 如何删除证书?

    acme.sh --remove -d example.com
    

八、总结

  • acme.sh 的便捷性和灵活性
  • 推荐使用 acme.sh 替代 certbot
  • 鼓励读者尝试并分享经验

相关文章:

  • 【数据挖掘】深度挖掘
  • vue3-05reactive定义对象类型的响应式数据(不能进行基本类型数据的响应式)
  • 聚焦于机器人研究,提出 FuSe 方法,通过语言锚定对通用机器人策略进行微调 视觉、触觉、听觉
  • ET框架实现匹配功能(服务器端)
  • TArray系列(二)
  • 【linux】文件与目录命令 - grep
  • UNIAPP开发之利用阿里RTC服务实现音视频通话后端THINKPHP5
  • 磐维数据库双中心容灾流复制集群搭建
  • K8S下redis哨兵集群使用secret隐藏configmap内明文密码方案详解
  • 我的文具盒作文范文
  • windows使用命令解压jar包,替换里面的文件。并重新打包成jar包,解决Failed to get nested archive for entry
  • 软件单元测试的技术要求
  • 日期类(完全讲解版)
  • 【Server Components 解析:Next.js 的未来组件模型】
  • Unity for Python —— 强大的 Python 脚本支持提升 Unity 编辑器效率
  • 前沿科技:改变生活的十大趋势
  • 后端开发:开启技术世界的新大门
  • playwright 实现自动上传,多元素操作
  • 性能:React 实战优化技巧 之 函数闭包
  • 一文讲解Redis为什么读写性能高以及I/O复用相关知识点
  • 现场观察·国防部记者会|美将举行大演习“应对中国”,备战太平洋引发关注
  • 云南昭通黄吉庆寻子29年终团聚:儿子在同事鼓励下回乡认亲
  • “家门口的图书馆”有多好?上海静安区居民给出答案
  • 百年前的亚裔艺术家与巴黎
  • 观察|动力电池步入“多核时代”,宁德时代新技术密集开箱有何启示
  • 赵志丹任中国地质大学(北京)校长