讓加密自動續訂安靜模式錯誤

讓加密自動續訂安靜模式錯誤

我已經安裝了 let's encrypt with Nginx 設定和 DNS 驗證模式,按照自動續訂文件中的說明,我新增了以下條目:

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

然而,這不起作用,所以我在命令列中運行它來看看發生了什麼。我收到下面的錯誤,我確實知道連接埠 80/443 正在被 Nginx 使用,當我手動更新它時我必須停止它,我想知道如何將其設定為自動更新模式,即在此之前添加 stop Nginx cronjob並在它之後重新啟動?但在 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,而不是啟動它的開放網路伺服器。

certbot renew --quiet --nginx

或者

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

成功續訂後,不要忘記使用該--deploy-hook參數重新載入 nginx。

注意:如果您尚未安裝 nginx 插件,則必須使用以下命令安裝它。

yum install python-certbot-nginx

相關內容