If you are using a free SSL/TLS certificate from Certbot, probably you are tired of the manual renewal. Here I’m going to show you how to automate the process of creating a cron job that will automatically renew the expired certificates.
- Debian-based distro
Step 1. Navigate to the
Step 2. Create a new file called
Step 3. Open the Certbot file and paste the following config:
SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 0 0 * * * /usr/bin/certbot renew && systemctl restart nginx
Note: Confirm the Certbot binary path by running
which certbot. Mostly, Certbot could be found under:
Step 4. Restart the
systemctl restart cron
Now, this cron job will check if some certificates are expired it will renew it automatically. In the next topic you will see how to renew it on RHEL-based distros. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.