XuLaLa.Tech

首页客户端下载Windows 使用V2Ray 教程SSR 教程Clash 教程

使用 Acme.sh使用生成Let’s Encrypt免费泛域名证书

2025.04.09

Acme.sh是一个实现ACME客户端协议的纯Unix shell脚本,能够很方便帮我们生成Let’s Encrypt免费证书,其中单域名证书可以直接和相关的云结合像阿里云、腾讯云等,自动续费证书,泛域名证书没法直接集成,只提供90天服务,到期后需要手动重新生成。

文章目录

  • 1 Acme.sh安装
    • 1.1 Bash安装
    • 1.2 Git安装
  • 2 Acme.sh生成证书
    • 2.1 生成域名TXT记录
    • 2.2 验证TXT记录
    • 2.3 安装
    • 2.4 配置
  • 3 常见问题

Acme.sh安装

Bash安装

acme.sh

curl https://get.acme.sh | sh -s [email protected]
wget -O -  https://get.acme.sh | sh -s [email protected]

Git安装

git clone https://github.com/acmesh-official/acme.sh.git
cd ./acme.sh
./acme.sh --install -m [email protected]

Acme.sh生成证书

生成域名TXT记录

acme.sh --issue -d "*." --dns \
--yes-I-know-dns-manual-mode-enough-go-ahead-please --server letsencrypt

验证TXT记录

acme.sh --renew -d "*." --dns \
--yes-I-know-dns-manual-mode-enough-go-ahead-please --log

安装

openssl dhparam -out /etc/nginx/dhparam.pem 2048
mkdir /etc/nginx/cert/
acme.sh --install-cert -d *. \
--key-file       /etc/nginx/cert//.key \
--fullchain-file /etc/nginx/cert//fullchain.cer

配置

ssl_certificate     /etc/nginx/cert//fullchain.cer;
ssl_certificate_key /etc/nginx/cert//.key;
include             /etc/nginx/ssl-options.conf;
ssl_dhparam         /etc/nginx/dhparam.pem;

常见问题

1、续费不成功
请使用root用户来执行

2、nginx访问不了
权限问题,重启nginx

3、域名配置TXT记录,解析不到
域名配置TXT需要10分钟之后才能生效,等待后重试

© 2010-2022 XuLaLa 保留所有权利 本站由 WordPress 强力驱动
请求次数:69 次,加载用时:0.665 秒,内存占用:32.19 MB