Let's Encrypt 自动更新静音模式错误

Let's Encrypt 自动更新静音模式错误

我已经安装了 let's encrypt,并使用 Nginx 配置了 DNS 验证模式,按照自动续订文档中的说明,我添加了以下条目:

15 3 * * * /usr/bin/certbot renew --quiet

但是,这不起作用,所以我在命令行中运行它以查看发生了什么。我收到以下错误,我确实知道端口 80/443 被 Nginx 使用,并且我必须在手动续订时停止它,我想知道如何在自动续订模式下设置它,即在此 cronjob 之前添加停止 Nginx 并在之后重新启动?但在 cronjob 上执行此操作有点太危险了,因为如果 Nginx 失败,它会造成大量停机时间。

[centos]# /usr/bin/certbot renew --quiet
Attempting to renew cert (example.com) from /etc/letsencrypt/renewal/example.com.conf produced an 
unexpected error: 
Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.

All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/example.com/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)

任何想法?

答案1

使用以下命令运行 certbot--nginx或者--webroot参数,如文档所述,让它使用您正在运行的 nginx,而不是启动它的开放的 web 服务器。

certbot renew --quiet --nginx

或者

certbot renew --quiet --webroot --webroot-path /var/www/html

不要忘记--deploy-hook在成功更新后使用参数重新加载 nginx。

注意:如果您尚未安装 nginx 插件,则必须使用以下命令安装。

yum install python-certbot-nginx

相关内容