Categories: DevOps

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

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

Acme.sh安装

Bash安装

acme.sh

curl https://get.acme.sh | sh -s email=my@example.com
wget -O -  https://get.acme.sh | sh -s email=my@example.com

Git安装

git clone https://github.com/acmesh-official/acme.sh.git
cd ./acme.sh
./acme.sh --install -m my@example.com

Acme.sh生成证书

生成域名TXT记录

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

验证TXT记录

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

安装

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

配置

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

常见问题

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

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

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

4.7
07
Git为github设置代理
Gitlab升级路线神器推荐
嘻嘻

嘻嘻IT: 笔者是一个工作七八年的程序猿老鸟,从事涉及的技术栈主要包括PHP、Linux、Devops等,喜欢研究新技术,尝试新技术,提升技术自动化和开发效率,致力于write less,do more! 技术每年都会层出不穷,领域划分的越来越细,不可能学习所有的东西,保持对技术的好奇心,理解技术中核心思想,做一个有深度,有思想的开发!

Recent Posts

Clockwise一款AI日历工具

Clockwise是一款创新的…

22小时 ago

IT Tools一款开发人员的实用开源在线工具(11.5k stars)

IT Tools是一款免费且开…

22小时 ago

Leonardo一个视觉创意AI生成平台

Leonardo.ai提供了一…

23小时 ago

DupDub一款终极AI内容创作助手

DupDub 是一个一站式内容…

23小时 ago

Murf AI是一款尖端的AI声音生成器

Murf AI是一款尖端的AI…

23小时 ago