Hi I have Certbot installed as a snap. https://iatse118.com/ is on Ubuntu Bionic for a Laravel website on Vultr, using Nginx as the webserver.
I have things set up now but I want to report my issue anyway because I want to do better at this, or maybe someone else has the same problem.
I got an email about the certificate expiring in a couple of days, so I went and manually ran the certificate renewal from the shell and it crashed the site.
With a little help, I was able to learn that running certbot renew –quiet had added additional identical directive blocks in nginx.conf .
The problem was resolved by removing the clone blocks from nginx.conf and installing a root cron for Certbot renewal in /etc/cron.d/certbot instead of trying to execute the renewal as the regular user.
The cron looks like this:
0 */12 * * * root test -x /usr/bin/certbot -a ! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
then it worked, problem solved.
This cron gets installed, I understand, when installing the apt-get Certbot package, but not the snap. Not sure what is going on here.
I realize the issue may be in part due to my knowledge. However I set up a Certbot cert on a DO server some time back and have had no problems with it, renewals run by cron for regular user.