-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
issue-ssl.md
116 lines (68 loc) · 2.41 KB
/
issue-ssl.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
## 申请 SSL 证书
第一种方法是自行到国内云服务商等处申请 SSL 证书。
你也可以使用以下命令申请(由 [acme.sh](https://github.com/acmesh-official/acme.sh) 提供技术支持,感谢 [Let's Encrypt](https://letsencrypt.org/))。
## 通配符证书
Let's Encrypt 现已支持通过 DNS 验证来申请通配符证书,本例以通配符证书为例。
## 确定域名的 DNS 服务商
在 https://github.com/acmesh-official/acme.sh/tree/master/dnsapi 找到自己域名的 DNS 服务商代码,例如
* `dnspod.cn` 代码为 `dns_dp`
* `GoDaddy.com` 代码为 `dns_gd`
...
## 修改 .env 文件
根据 DNS 服务商,自行在 `.env` 文件设置相关变量
* dnspod.cn
```bash
# [DNSPOD]
DNS_TYPE=dns_dp
DP_Id=
DP_Key=
```
* GoDaddy.com
```bash
# DNS 服务商
DNS_TYPE=dns_gd
GD_Key=sdf...
GD_Secret=sdf...
```
...
### 申请网站证书
除了 `acme.sh` 原始参数外,支持以下参数
* `--httpd`
* `--rsa`
```bash
# 首次使用必须执行此命令
$ ./lnmp-docker acme.sh --register-account -m my@example.com(替换为自己的邮箱)
```
```bash
$ ./lnmp-docker ssl example.com -d *.example.com -d t.example.com -d *.t.example.com [--debug]
```
> 特别提示,`*.example.com` 的证书不支持 `example.com` 所以一个主域要写两次
> 特别提示,第一个网址不用加 `-d` 参数,后面的需要加 `-d` 参数
若你的网站服务器不是 NGINX 而是 HTTPD,那么请加上 `--httpd` 参数,即
```bash
$ ./lnmp-docker ssl example.com -d *.example.com --httpd
```
默认申请 `ECC` 证书,你可以加上 `--rsa` 来申请 RSA 证书,即
```bash
$ ./lnmp-docker ssl example.com -d *.example.com --rsa
```
### 生成证书的位置
`./config/nginx/ssl/*`
## 其他
### 签发自签名证书
```bash
$ ./lnmp-docker ssl-self khs1994.com *.khs1994.com 127.0.0.1 localhost
```
生成的 ssl 文件位于 `./config/nginx/ssl-self`。
务必在浏览器导入根证书(`./config/nginx/ssl-self/root-ca.crt`)。
> `https://*.t.khs1994.com` 均指向 `127.0.0.1` 你可以使用这个网址测试 `https`。
## 示例配置
请查看 `./config/nginx/demo-*.conf`
## 第三方工具
* https://zerossl.com/
## HTTP3
* https://github.com/khs1994-docker/nginx
# More Information
* https://letsencrypt.org/docs/client-options/
* https://github.com/khs1994-website/server-side-tls
* https://github.com/khs1994-docker/tls