Lets Encrypt Setup Error Ubuntu 18.04

Hi everyone,

I am trying to setup ERPNext on a managed server behind d a VPN, each time I run sudo -H bench setup lets-encrypt sitename. I get an error saying Nginx has stopped, the output of sudo journalctl -xe below.

    `nginx: [emerg] > BIO_new_file("/etc/letsencrypt/live/domain_name/fullchain.pem") fail (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/domain_name/fullchain.pem'
nginx: configuration file /etc/nginx/nginx.conf test failed
 nginx.service: Control process exited, code=exited status=1
 pam_unix(sudo:session): session closed for user root
nginx.service: Failed with result 'exit-code'. 
Failed to start A high performance web server and a reverse proxy server.
Subject: Unit nginx.service has failed
Defined-By: systemd`

Also, I noticed this while setting up Lets Encrypt.

http-01 challenge for erp.domain.name
Waiting for verification...
Challenge failed for domain erp.domain.name
http-01 challenge for erp.domain.name
Cleaning up challenges
Some challenges have failed.

 - The following errors were reported by the server:

   Domain: erp.domain.name
   Type:   unauthorized
   Detail: Invalid response from
   [2606:4700:3031::ac43:a652]: "<!DOCTYPE html>\n<!--[if lt IE 7]>
   <html class=\"no-js ie6 oldie\" lang=\"en-US\">
  <![endif]-->\n<!--[if IE 7]>    <html class=\"no-js "
   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
  making regular backups of this folder is ideal.

For some reason, the certificate and key files are not being created on the server.

Does anyone have any idea where the error is coming from?

Looks like LetsEncrypt doesn’t support 18.04 anymore.

They want us to update to newer OS version or use 0.31 version of Letsencrypt


Maybe we need to add check OS version in letsencrypt argument of bench so if it is 18.04 then it will pass --no-self-upgrade