Lets-encrypt setup problem

I have setup a production server of ERPNext 14.

I had installed Lets-encrypt using the command sudo bench setup lets-encrypt <SiteName> and this was working properly.

But the certificate did not getting updated automatically. So I used the command sudo bench renew-lets-encrypt to manually renew it.

But now when I try to access the server using https it does not load. And I see the error Error code: SSL_ERROR_RX_RECORD_TOO_LONG in Firefox and ERR_SSL_PROTOCOL_ERROR in Chrome.

How to solve this problem and re-setup Lets-encrypt?

i never use the bench for letsencrypt

$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python3-certbot-nginx

Get Certificate

sudo certbot --nginx -d <your-domain>

Automatic Renewal

 crontab -e

0 12 * * * /usr/bin/certbot renew --quiet

Also Enable Multitenenancy if above don’t work

bench config dns_multitenant on
1 Like

Thanks for the commands. But this one is not working. It gives following error:

crontab: invalid option -- '-'
crontab: usage error: unrecognized option
usage:  crontab [-u user] file
        crontab [ -u user ] [ -i ] { -e | -l | -r }
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)
        -i      (prompt before deleting user's crontab)
1 Like
 crontab -e

This will open the Editor

0 12 * * * /usr/bin/certbot renew --quiet

Paste above line and save it

1 Like

In this one the Multi Tenency Command is wrong switch it on

bench config dns_multitenant on
1 Like

Multi Tenancy is on.

Do I have to restart any services?

restart nginx and supervisor

sudo service nginx restart

sudo supervisorctl restart all
1 Like

Thank you very much for helping me setup Lets Encrypt.