LoginSignup
2
1

More than 1 year has passed since last update.

Let’s Encrypt を更新したときCould not bind TCP port 80 because it is already in use by another process on this system (such as a web server) とでた場合の対処法

Posted at

エラー内容

Let’s Encryptを更新しようとすると下記のエラーが出ます。

sudo certbot renew --dry-run
Attempting to renew cert (kakuuchi.cyou) from /etc/letsencrypt/renewal/kakuuchi.cyou.conf produced an unexpected error: Could not bind TCP port 80 because it is already in use by another process on this system (such as a web server). Please stop the program in question and then try again.. Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/kakuuchi.cyou/fullchain.pem (failure)

対処法

「80のポートが既に使われている、、、」、といったメッセージだったので、一旦Port:80のサービスを落とした後にrenewし、nginxを再起動して解決しました。


# port:80で使っているサービスを確認
sudo lsof -i tcp:80

# port:80で使っているサービスを停止
sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill

# Let’s Encrypt を更新(練習)
sudo certbot renew --dry-run

# Let’s Encrypt を更新(本番)
sudo certbot renew

# 停止していたサービスを再起動
sudo systemctl restart nginx
sudo systemctl restart gunicorn

PostScript

webサーバはnginxを使っているのですが、

を見ると sudo certbot renew --dry-run --nginx で更新できるとのことでしたが、なぜがうまくいかず:unamused:

次の更新時で確認するしかない。

Reference

2
1
1

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
2
1