To install LetsEncrypt free SSL on ERPnext site, run
sudo -H bench setup lets-encrypt [site-name] --custom-domain [custom-domain]
Example
sudo -H bench setup lets-encrypt lab.serverok.in
To renew SSL, you can run
sudo bench renew-lets-encrypt
This will ask for your confirmation to restart nginx. Running this on cronjob won’t work. But you can use “echo y” to get it work. But it is better just to certbot-auto to renew SSL.
Auto Renew ERPnext SSL
To auto renew create a cronjob
crontab -e
Add
30 2 * * 1 /usr/serverok/ssl-renew >> /var/log/le-renew.log
Create file
mkdir /usr/serverok/
vi /usr/serverok/ssl-renew
Add
#!/bin/bash
systemctl stop nginx
/opt/certbot-auto renew
systemctl start nginx
Make it executable
chmod 755 /usr/serverok/ssl-renew