当前位置: 首页 > 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
  • 鼓励读者尝试并分享经验

http://www.mrgr.cn/news/91642.html

相关文章:

  • Android JNI的理解与使用。
  • 以deepseek为例的AI学习及公司知识库的搭建
  • 基于 Spring Boot 的社区居民健康管理系统部署说明书
  • Lua笔记
  • 泰山派RK3566移植QT,动鼠标时出现屏幕闪烁
  • Kubernetes的Ingress 资源是什么?
  • linux使用
  • 导出指定文件夹下的文件结构 工具模块-Python
  • 使用rknn进行yolo11-pose部署
  • 数组和指针常见笔试题(深度剖析)
  • POI pptx转图片
  • fpga助教面试题
  • 单细胞转录组画小提琴VlnPlot只显示需要类型细胞
  • 在项目中调用本地Deepseek(接入本地Deepseek)
  • DeepSeek大模型简介
  • MySQL 主从复制原理及其工作过程
  • ubuntu源码方式安装TensorRT-LLM推理框架(超详细)
  • VScode C语言学习开发环境;运行提示“#Include错误,无法打开源文件stdio.h”
  • CRTP在项目优化中的使用
  • uniapp图像转换(获取本地选取或拍照的图片的base64、Blob、图像和base64的转换)