更新
This commit is contained in:
1 parent
5cd551a08e
commit
40cde540d6
33 files changed
+547
-319
No files matched your search
@@ -1,9 +1,13 @@
|
||||
---
|
||||
title: 使用acme.sh 申请 Let's Encrypt 泛域名SSL证书
|
||||
tags: []
|
||||
id: '333'
|
||||
categories:
|
||||
- - 分享
|
||||
- 分享
|
||||
tags:
|
||||
- SSL证书
|
||||
- acme.sh
|
||||
- Let's Encrypt
|
||||
- 泛域名
|
||||
date: 2018-07-23 18:25:45
|
||||
---
|
||||
|
||||
@@ -13,7 +17,8 @@ date: 2018-07-23 18:25:45
|
||||
|
||||
### 安装acme.sh
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
curl https://get.acme.sh sh
|
||||
```
|
||||
|
||||
@@ -23,9 +28,10 @@ curl https://get.acme.sh sh
|
||||
|
||||
目前泛域名证书仅支持DNS验证,acme.sh通过DNS提供商的API自动完成操作,因此需要先设置DNS API,以阿里云为例。
|
||||
|
||||
先前往阿里云后台获取App\_Key跟App\_Secret,在【用户信息管理】-【安全信息管理】创建SecretKey [传送门](https://ak-console.aliyun.com/#/accesskey),然后执行以下脚本
|
||||
先前往阿里云后台获取App\_Key跟App\_Secret, 在【用户信息管理】-【安全信息管理】创建SecretKey [传送门](https://ak-console.aliyun.com/#/accesskey),然后执行以下脚本
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
# 替换成从阿里云后台获取的密钥
|
||||
export Ali_Key="LTA*********uV6"
|
||||
export Ali_Secret="QKmsZgo*************8Htr6"
|
||||
@@ -35,21 +41,24 @@ export Ali_Secret="QKmsZgo*************8Htr6"
|
||||
|
||||
### 获取证书
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
# 换成自己的域名
|
||||
acme.sh --issue --dns dns_ali -d dengtongyu.com -d *.dengtongyu.com
|
||||
```
|
||||
|
||||
如果acme.sh,提示命令没找到,那就请再执行以下指令:
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
source ~/.bashrc
|
||||
acme.sh --issue --dns dns_ali -d dengtongyu.com -d *.dengtongyu.com
|
||||
```
|
||||
|
||||
或者先cd到acme.sh目录下,再执行文件
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
cd ~/.acme.sh
|
||||
./acme.sh --issue --dns dns_ali -d dengtongyu.com -d *.dengtongyu.com
|
||||
```
|
||||
@@ -66,9 +75,10 @@ cd ~/.acme.sh
|
||||
|
||||
注意, 默认生成的证书都放在安装目录下: ~/.acme.sh/, 请不要直接使用此目录下的文件, 例如: 不要直接让 nginx/apache 的配置文件使用这下面的文件. 这里面的文件都是内部使用, 而且目录结构可能会变化.
|
||||
|
||||
正确的使用方法是使用 --installcert 命令,并指定目标位置, 然后证书文件会被copy到相应的位置:
|
||||
正确的使用方法是使用 --installcert 命令, 并指定目标位置, 然后证书文件会被copy到相应的位置:
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
acme.sh --installcert -d dengtongyu.com \
|
||||
--key-file /etc/nginx/ssl/dengtongyu.key \
|
||||
--fullchain-file /etc/nginx/ssl/fullchain.cer \
|
||||
@@ -81,7 +91,8 @@ acme.sh --installcert -d dengtongyu.com \
|
||||
|
||||
Nginx 配置文件片断:
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
server {
|
||||
server_name xxx.com;
|
||||
listen 443 http2 ssl;
|
||||
@@ -99,4 +110,4 @@ server {
|
||||
|
||||
Let's Encrypt 证书的有效期为三个月,acme.sh会每隔60天自动帮你续期,你无需任何操作
|
||||
|
||||
最后,更详细等内容请看[官方说明](https://github.com/Neilpang/acme.sh/wiki/%E8%AF%B4%E6%98%8E)
|
||||
最后,更详细等内容请看[官方说明](https://github.com/Neilpang/acme.sh/wiki/%E8%AF%B4%E6%98%8E)
|
||||
Reference in new issue
Block a user