14

On a setup with Ubuntu 16.04, Certbot 0.28.0, and nginx 1.10.3, I can't use Certbot to renew an existing certificate.

  1. When I run sudo certbot renew, it fails and I get these errors:

    Hook command "nginx -s stop" returned error code 1
    Error output from nginx:
    nginx: [error] invalid PID number "" in "/run/nginx.pid"
    
  2. And when I run sudo certbot --nginx, it fails with this error:

    certbot.errors.MisconfigurationError: nginx restart failed:
    

1 Answer 1

16

The error you shared above was not complete, the actual error looks something like:

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)

To fix this error, run:

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

Read more on this here: https://stevespindler.com/whats-taking-up-my-time/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.