Certbot Does not restarts Nginx after renew

My domain is: el.pgc.edu

My web server is (include version): nginx and kestrel

The operating system my web server runs on is (include version): Ubuntu 16 Server LTS
I can login to a root shell on my machine (yes or no, or I don’t know): Yes

I have been seeing this error since yesterday, at around 12:05 PM +5 GMT the Certbot goes for auto renewal and stops nginx but it does not starts it again. I checked Syslog and these errors are there.

Is there any anyway to stop auto renewal and put it to manual?
May 26 12:04:56 elwebserver systemd[1]: Starting Certbot…
May 26 12:04:56 elwebserver EL PGC[2443]: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
May 26 12:04:56 elwebserver EL PGC[2443]: Request starting HTTP/1.0 GET http://localhost:5003/dist/vendor.css?v=IWx6R6_NjmerwDLCpUxWZoC0gFF6spa09pA4lA6HMQw
May 26 12:04:56 elwebserver EL PGC[2443]: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
May 26 12:04:56 elwebserver EL PGC[2443]: Sending file. Request path: ‘/dist/vendor.css’. Physical path: ‘/home/pgc/ElPGC/publish/wwwroot/dist/vendor.css’
May 26 12:04:56 elwebserver EL PGC[2443]: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
May 26 12:04:56 elwebserver EL PGC[2443]: Request finished in 23.6757ms 200 text/css
May 26 12:04:57 elwebserver certbot[4399]: Could not open file: /etc/nginx/sites-enabled/example.com
May 26 12:04:59 elwebserver systemd[1]: Stopping A high performance web server and a reverse proxy server…
May 26 12:05:04 elwebserver systemd[1]: Stopped A high performance web server and a reverse proxy server.
May 26 12:05:10 elwebserver certbot[4399]: nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
May 26 12:05:11 elwebserver EL PGC[2443]: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
May 26 12:05:11 elwebserver EL PGC[2443]: Request starting HTTP/1.0 GET http://localhost:5003/images/mcqs.svg
May 26 12:05:11 elwebserver EL PGC[2443]: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2]
May 26 12:05:11 elwebserver EL PGC[2443]: Sending file. Request path: ‘/images/mcqs.svg’. Physical path: ‘/home/pgc/ElPGC/publish/wwwroot/images/mcqs.svg’
May 26 12:05:11 elwebserver EL PGC[2443]: #033[40m#033[32minfo#033[39m#033[22m#033[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
May 26 12:05:11 elwebserver EL PGC[2443]: Request finished in 0.5846ms 200 image/svg+xml
May 26 12:05:12 elwebserver systemd[1]: Starting A high performance web server and a reverse proxy server…
May 26 12:05:12 elwebserver nginx[4501]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
May 26 12:05:12 elwebserver nginx[4501]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
May 26 12:05:12 elwebserver nginx[4501]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
May 26 12:05:12 elwebserver nginx[4501]: nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)

Check that your nginx configuration actually compiles:

nginx -t

If it doesn’t, then Certbot wouldn’t be able to work with it and might result in crashes like this.

If it does pass that test, then it’s something more complicated. What might help in that case is to post the full log file from /var/log/letsencrypt/ as well as the /etc/letsencrypt/renewal/<your domain>.conf renewal parameters.

Finally, your logs look slightly familiar to this issue: https://github.com/certbot/certbot/issues/5486#issuecomment-363970559 but it is worth investigating the other things first.

I’m curious to see what is running on ports 80 & 443 when nginx is not.
netstat -lpnt | grep -E ':80|:443'

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.