add article acme.sh

This commit is contained in:
Tsanie Lily 2021-08-16 16:45:04 +08:00
parent 2d5863c183
commit 2f12cd1030
2 changed files with 76 additions and 3 deletions

View File

@ -3,17 +3,17 @@
"version": "1.0.0",
"private": true,
"hexo": {
"version": "5.2.0"
"version": "5.4.0"
},
"dependencies": {
"hexo": "^5.2.0",
"hexo": "^5.4.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-index": "^2.0.0",
"hexo-generator-sitemap": "^2.1.0",
"hexo-generator-tag": "^1.0.0",
"hexo-renderer-ejs": "^1.0.0",
"hexo-renderer-marked": "^3.2.0",
"hexo-renderer-marked": "^4.1.0",
"hexo-renderer-stylus": "^2.0.1",
"hexo-server": "^2.0.0"
}

73
source/_posts/acme-sh.md Normal file
View File

@ -0,0 +1,73 @@
---
title: 使用 acme.sh 来管理 letsencrypt 证书
date: 2021-08-16 16:15:09
tags:
---
## 安装 acme.sh ##
```shell
curl https://get.acme.sh | sh
```
安装完毕后可以使用 `acme.sh --version` 检查状态
```shell
# acme.sh --version
https://github.com/acmesh-official/acme.sh
v3.0.1
```
如果需要升级 `acme.sh` 则运行
```shell
# 升级到最新版
acme.sh --upgrade
# 开启自动升级
acme.sh --upgrade --auto-upgrade
# 关闭自动升级
acme.sh --upgrade --auto-upgrade 0
```
## 生成证书 ##
<!-- more -->
### HTTP 认证方式 ###
```shell
acme.sh --issue -d example.com -d www.example.com --webroot /home/wwwroot/example.com/
```
### DNS 认证方式 ###
各大 dns 提供商的使用方式参考[此处](https://github.com/acmesh-official/acme.sh/wiki/dnsapi)
此处以 cloudflare 为例:
```shell
export CF_Token="sdfsdfsdfljlbjkljlkjsdfoiwje"
export CF_Account_ID="xxxxxxxxxx"
export CF_Zone_ID="xxxxxxxxxx"
acme.sh --issue --dns dns_cf -d example.com -d *.example.com --server letsencrypt
```
## 操作已安装证书 ##
```shell
# 查看已安装证书
acme.sh --list
# 删除证书
acme.sh remove <SAN_domains>
```
## 安装证书 ##
```shell
# 以 example.com 为例
acme.sh --installcert -d example.com \
--key-file /usr/local/nginx/ssl/example.com.key \
--fullchain-file /usr/local/nginx/ssl/fullchain.cer \
--reloadcmd "systemctl reload nginx ; systemctl restart v2ray"
```
## 更新证书 ##
如果需要手动续签,则执行
```shell
acme.sh --renew -d example.com --force
```