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

全球货币导航网页上线了!

o在全球化的今天,货币兑换和国…

8小时 ago

bash字符串拼接

在编程中,字符串的拼接是一个非…

8小时 ago

Bash Case详解

Bash case 语句通常用…

8小时 ago

Bash for详解

for循环是编程语言中的基础概…

9小时 ago

liunux中你必须知道alias命令?

在Linux操作系统中,无论你…

1天 ago

zshrc文件详解

Zsh 是一个强大的 shel…

2天 ago