gogs上用letsencrypt生成的ssl证书无法续期,

执行

/usr/local/python/bin/certbot renew --force-renew --renew-hook "/etc/init.d/nginx reload"

总是出现无法认证。 于是弃坑,准备用acme 并用dns的方式重新申请证书

acme的安装

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

然后执行

source ·/.bashrc 

使配置生效

生成证书

acme.sh --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please -d gogs.jieblog.win 

将生成的txt记录的信息填入 域名解析中 等待一段时间 执行

 acme.sh --renew -d gogs.jieblog.win --yes-I-know-dns-manual-mode-enough-go-ahead-please

来更新证书

更新配置

将nginx 指向 新生成的证书 如

ssl_certificate /usr/local/nginx/conf/ssl/gogs.jieblog.win.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/gogs.jieblog.win.key;

然后 重启下nginx

service nginx restart 

打开浏览器可以发现证书已经更新成功了