Lets Encrypt error on ERPNext ver 12 on Ubuntu 16.04

I am trying to install LetsEncrypt on Ver 12 ERPNext and I get the following error.

sudo -H bench setup lets-encrypt site1.local --custom-domain my.customdomain.com
Running this will stop the nginx service temporarily causing your sites to go offline
Do you want to continue? [y/N]: y
$ sudo systemctl stop nginx
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/mmpy3/.bench/bench/cli.py”, line 41, in cli
bench_command()
File “/usr/local/lib/python3.5/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.5/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.5/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.5/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.5/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/mmpy3/.bench/bench/commands/setup.py”, line 122, in setup_letsencrypt
setup_letsencrypt(site, custom_domain, bench_path=“.”, interactive=not non_interactive)
File “/home/mmpy3/.bench/bench/config/lets_encrypt.py”, line 42, in setup_letsencrypt
run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive)
File “/home/mmpy3/.bench/bench/config/lets_encrypt.py”, line 57, in run_certbot_and_setup_ssl
get_certbot()
File “/home/mmpy3/.bench/bench/config/lets_encrypt.py”, line 103, in get_certbot
urlretrieve (“https://dl.eff.org/certbot-auto”, certbot_path)
File “/usr/lib/python3.5/urllib/request.py”, line 188, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File “/usr/lib/python3.5/urllib/request.py”, line 163, in urlopen
return opener.open(url, data, timeout)
File “/usr/lib/python3.5/urllib/request.py”, line 472, in open
response = meth(req, response)
File “/usr/lib/python3.5/urllib/request.py”, line 582, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib/python3.5/urllib/request.py”, line 510, in error
return self._call_chain(*args)
File “/usr/lib/python3.5/urllib/request.py”, line 444, in _call_chain
result = func(*args)
File “/usr/lib/python3.5/urllib/request.py”, line 590, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

I believe this command is not valid anymore as the certbot-auto has been deprecated by certbot.
I generate SSL by using certbot installed via snap (https://certbot.eff.org/lets-encrypt/snap-nginx.html)
Then use the command:

sudo certbot --nginx
2 Likes

Okay, thanks! I used sudo certbot --nginx, but the https does not kick in automatically. initial when I type the domain www.mydomain.com the browser shows that it’s non-secure. But if I manually change that to https://www.mydomain.com it then starts working on https.

Any suggestions?

Thanks

Jay

Have you update the nginx?

bench setup nginx
bench setup reload-nginx

In the /config/nginx.conf there is # http to https redirect section

A post by @bkm