Certbot MisconfigurationError:nginx重启失败

Jos*_*osh 6 ubuntu nginx certbot

在 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"
    
    Run Code Online (Sandbox Code Playgroud)
  2. 当我运行时sudo certbot --nginx,它因以下错误而失败:

    certbot.errors.MisconfigurationError: nginx restart failed:
    
    Run Code Online (Sandbox Code Playgroud)

jam*_*ace 7

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

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)
Run Code Online (Sandbox Code Playgroud)

要修复此错误,请运行:

sudo fuser -k 443/tcp
sudo fuser -k 80/tcp
sudo service nginx restart
sudo certbot --nginx
Run Code Online (Sandbox Code Playgroud)

在这里阅读更多信息:https://stevespindler.com/whats-take-up-my-time/