Let’s Encrypt 泛域名配置证书
发表于:2021-09-26 |

安装acme.sh

curl https://get.acme.sh | sh

  1. Failed connect to raw.githubusercontent.com:443;
  2. Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 7

#通过修改host解析

sudo vim /etc/hosts

添加如下内容

140.82.114.4 github.com

185.199.108.153 github.github.io

199.232.69.194 github.global.ssl.fastly.net

199.232.28.133 raw.githubusercontent.com

通过修改之后,上述可以成功

不行的就拿下面这个地址

wget -O - https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh | INSTALLONLINE=1 sh

获取阿里云Accesskey
阿里云dns
阿里云
申请地址:https://ak-console.aliyun.com/#/accesskey

export Ali_Key=”对应Access Key ID”
export Ali_Secret=”对应Access Key Secret”

./acme.sh –issue –dns dns_ali - d *.hhui.top

接下来将我们的证书安装到 nginx(当然也可以是 tomcat),下面的脚本除了安装之外,也添加了一个自动更新的任务(一般来说,60 天以后会自动更新,并会强制重启 nginx 使新的证书生效,可以通过 crontab -e看到对应的定时任务

./acme.sh –installcert -d *.hhui.top –key-file /etc/nginx/ssl/key.pem –fullchain-file /etc/nginx/ssl/cert.pem –reloadcmd “service nginx force-reload”

然后就是配置 nginx,支持 https

ACME 手动续期命令

acme.sh –cron –force –debug 2

上一篇:
MySQL查看数据库表容量大小
下一篇:
如何清除没用的 docker 镜像 (image) 文件