When I visit the website in the browser, the browser tells me the certificate expired on 2020-10-11. When I run certbot certificates in the server, I'm told the certificate is valid until 2020-12-11. Does anyone know why this happened and how to fix it? Details below. Thanks.
None of the certs maintained by certbot are expired and all of the certs used by nginx are from that path.
Try restarting nginx: sudo systemctl restart nginx
So you need to incorporate the restart after each renewal.
This can be done with a --deploy-hook script.
Or a daily/weekly cron job.
Perhaps doing a reload (to be less intrusive) if doing it daily. sudo systemctl reload nginx
Great. Documentation around the deploy hook scripting is a bit thin, so please point me to a doc if you know of one. Otherwise, I will just hack away at it Thanks again!
The script is well just a script - like any other executable bash script file.
It can be called directly inline with certbot anything like: certbot renew --deploy-hook /myscripts/reload.nginx.sh
OR you can make a cron job to call the script or just straight to the command: systemctl reload nginx
I reload my nginx several times a day with cron: 10 1,7,13,19 * * * /bin/systemctl reload nginx.service
No need to worry about how often you run the renew since the deployment hook will only be called if a new certificate is actually acquired.
When Certbot detects that a certificate is due for renewal, --pre-hook and --post-hook hooks run before and after each attempt to renew it. If you want your hook to run only after a successful renewal, use --deploy-hook in a command like this.