Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hungdev/3b47ebabaa0bda885e80ab7e8cfbfdfc to your computer and use it in GitHub Desktop.
Save hungdev/3b47ebabaa0bda885e80ab7e8cfbfdfc to your computer and use it in GitHub Desktop.
renew certificate lets encrypt centos nginx

manual:

cd /etc/letsencrypt
wget https://dl.eff.org/certbot-auto && chmod a+x certbot-auto

in this folder:

./certbot-auto renew

================

auto renew:

EDITOR=nano crontab -e

paste:

30 2 * * * /etc/letsencrypt/certbot-auto renew --pre-hook "service nginx stop" --post-hook "service nginx start" >> /var/log/letsencrypt-renew.log

================

Check if renewal was successful

openssl x509 -noout -dates -in /etc/letsencrypt/live/example.com/cert.pem

note: example.com is domain folder in live folder

after check, out put:

notBefore=Jul 11 08:08:03 2019 GMT .  // today
notAfter=Oct  9 08:08:03 2019 GMT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment