LoginSignup
6
4

More than 3 years have passed since last update.

Let's Encrypt更新!certbot renewコマンドでうまくいかなかったときの対処法

Posted at

環境

Linux CentOS 7
apache
Let's Encrypt

更新のエラー

Let's Encryptは3か月に1回毎に更新しなければいけません。
そのためバッチを使用して自動更新を行っているのですが、更新が失敗したという通知のメールが届きました。

実際にCentOSの中に入って以下のコマンドを実行

certbot renew --dry-run

以下、結果

Congratulations, all renewals succeeded.

あれ、成功してんじゃん

というわけでdry-runを外してやってみる事に。

certbot renew

以下、結果

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

むむむ

dry-runの時は成功して、本番実行時には失敗するという。。

エラーの内容を見ると、80ポートが使えませんでしたよ。みたいなことなんですが。

解決方法

/etc/letsencrypt/renewal/********.com.confへアクセス

以下の記述に注目

authenticator = standalone

standaloneモードになっている。。。!
standaloneモードは、80番ポートを使用するため、証明書を更新する際はapacheをいったん停止しなければならないとのこと。

それは困るのでwebrootパターンへ変更!!

[renewalparams]
#authenticator = standalone
#account = 98155b431f2d9036dcaae14606620c3f
#server = https://acme-v02.api.letsencrypt.org/directory
#installer = apache
authenticator = webroot
account = 56f88f044b7c750ee8b687a024c4ece1
server = https://acme-v02.api.letsencrypt.org/directory
post_hook = /usr/bin/systemctl reload httpd.service

[[webroot_map]]
*****.com = /var/www/html/****
www.*****.com = /var/www/html/****

設定完了後に、再度letsencryptの更新を行えば無事、完了。。。!

6
4
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
6
4