Certbot 配置错误:nginx 重新启动失败



在使用 Ubuntu 16.04、Certbot 0.28.0 和 nginx 1.10.3 的设置中,我无法使用 Certbot 续订现有证书。

  1. 当我运行sudo certbot renew时,它失败了,我得到这些错误:

    Hook command "nginx -s stop" returned error code 1
    Error output from nginx:
    nginx: [error] invalid PID number "" in "/run/nginx.pid"
    
  2. 当我运行sudo certbot --nginx时,它失败并显示此错误:

    certbot.errors.MisconfigurationError: nginx restart failed:
    

您上面共享的错误不完整,实际错误如下所示:

Encountered exception during recovery: certbot.errors.MisconfigurationError: nginx restart failed:
nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

若要修复此错误,请运行:

sudo fuser -k 443/tcp
sudo fuser -k 80/tcp
sudo service nginx restart
sudo certbot --nginx

在此处阅读更多相关信息:https://stevespindler.com/whats-taking-up-my-time/

最新更新