I have installed let's encrypt with Nginx configuration with DNS validation mode, As instructed on the documentation to auto-renew, I added the below entry:
15 3 * * * /usr/bin/certbot renew --quiet
However, this didn't work, so I run it in the command line to see what happened. I get the error below, I do understand that port 80/443 is in use by Nginx and I have to stop it when I renew it manually, I wonder how do I set it up in AUTO RENEW mode, i.e add stop Nginx before this cronjob and restart after it? But it's a bit too dangerous to do this on a cronjob as if the Nginx fails it creates a lot of downtimes.
[centos]# /usr/bin/certbot renew --quiet
Attempting to renew cert (example.com) from /etc/letsencrypt/renewal/example.com.conf produced an
unexpected error:
Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/example.com/fullchain.pem (failure)
1 renew failure(s), 0 parse failure(s)
Any idea?