49 lines
1.3 KiB
Markdown
49 lines
1.3 KiB
Markdown
# 通过Acme生成通配符证书
|
|
|
|
开源库:[](https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E)[https://github.com/acmesh-official/acme.sh/wiki/说明](https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E)
|
|
|
|
## 注意!先进入root用户!!!
|
|
|
|
### 1.[安装acme.sh](http://xn--acme-ke9g492u.sh/)
|
|
|
|
```bash
|
|
curl [<https://get.acme.sh>](<https://get.acme.sh/>) | sh -s [email=travis0213z@gmail.com](<mailto:email=travis0213z@gmail.com>)
|
|
```
|
|
|
|
### 2.export DP_ID 和 DP_KEY
|
|
|
|
```bash
|
|
export DP_Id="579962"
|
|
export DP_Key="1418e321d47f9a4cfbaa3ef6afc33724"
|
|
```
|
|
|
|
### 3.颁发证书
|
|
|
|
```bash
|
|
|
|
acme.sh --issue --dns dns_dp -d [niaodaifu.cn](<http://niaodaifu.cn/>) -d *.niaodaifu.cn
|
|
```
|
|
|
|
### 4.复制证书到指定路径并执行命令,会生成定时任务
|
|
|
|
```bash
|
|
|
|
#值得注意的是,这里指定的所有参数都会被自动记录下来,并在将来证书自动更新以后,被再次自动调用.
|
|
|
|
acme.sh --install-cert -d niaodaifu.cn --key-file /srv/ssl/niaodaifu.cn/key.pem --fullchain-file /srv/ssl/niaodaifu.cn/cert.pem --reloadcmd "service nginx reload"
|
|
```
|
|
|
|
### 5.重启nginx
|
|
|
|
```bash
|
|
|
|
sudo service nginx reload
|
|
```
|
|
|
|
### 6.查看是否生效
|
|
|
|
```bash
|
|
#默认使用zerossl进行颁发证书,可使用命令切换
|
|
acme.sh --set-default-ca --server zerossl
|
|
acme.sh --set-default-ca --server letsencrypt
|
|
``` |