LoginSignup
0
0

More than 3 years have passed since last update.

letsencrypt Attempting to renew cert from /etc/letsencrypt/renewal/ produced an unexpected error: Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.

Last updated at Posted at 2020-05-29

エラーが出た。


Attempting to renew cert from /etc/letsencrypt/renewal/ produced an unexpected error: Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.
Attempting to renew cert (caba-ageha.com) from /etc/letsencrypt/renewal/caba-ageha.com.conf produced an unexpected error: Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.


nginxを一旦停止させてから作業をしてねという意味

さぁ、nginxを停止してから更新しよう。


// Nginxの停止
systemctl stop nginx

// SSL証明書の更新
/usr/bin/certbot-auto renew

// Nginxの再起動
systemctl restart nginx

OK

certbot の renew サブコマンドは、標準で期限切れが近い (30 日未満) の証明書だけを自動で更新してくれる便利なサブコマンドです。 期限切れが近い証明書がなければ letsencrypt のサーバーへのアクセスがなく、余計な負荷をかけないので、1日2回実行が推奨されています。

cron にしたい

毎日の 午前 6:30 に実行


# 分 時 日 月 曜日 <実行コマンド>
30 6 * * * /usr/bin/certbot-auto renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --quiet

これで動く。

また、cronでcertbot-autoが正常に動いているかをチェックするために


# lets encrypt の ログを一覧
ls -ltr /var/log/letsencrypt
vim /var/log/letsencrypt/letsencrypt.log #このファイルが最新の cron の日時になっていれば、 certbot は動いているということになる。

期限が残っていても強制的に更新

force-renewal は 期限が残っていても強制更新。
更新制限にひっかかる可能性があるので、
あんまり使わないほうが良いみたい。


8 10 9 * * /usr/bin/certbot-auto renew --force-renewal --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --quiet

最終設定

僕の場合は、
毎月1日に確実に更新していきたいので。


30 6 1 * * /usr/bin/certbot-auto renew --force-renewal --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --quiet

こんあ塩梅ですね。

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0