Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Certbot MisconfigurationError: nginx restart failed

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:
    
like image 778
Josh Avatar asked Feb 11 '26 20:02

Josh


1 Answers

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/

like image 193
james ace Avatar answered Feb 17 '26 12:02

james ace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!