SSL Certificate with Letsencrypt

Wiki page :

2 Likes

Awesome. I’ve been trying to do this. My application is in a subdomain. I will try this later

Check this:

2 Likes

I followed the directions in the wiki but I got this error:

root@erp:/home/frappe/frappe-bench/sites/site1.local# bench setup nginx
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.0.0’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 60, in cli
bench()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/cli.py”, line 435, in setup_nginx
generate_nginx_config()
File “/home/frappe/bench-repo/bench/config.py”, line 69, in generate_nginx_config
sites = get_sites_with_config(bench=bench)
File “/home/frappe/bench-repo/bench/config.py”, line 56, in get_sites_with_config
site_config = get_site_config(site, bench=bench)
File “/home/frappe/bench-repo/bench/config.py”, line 50, in get_site_config
return json.load(f)
File “/usr/lib/python2.7/json/init.py”, line 290, in load
**kw)
File “/usr/lib/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 4 column 1 (char 64)
root@erp:/home/frappe/frappe-bench/sites/site1.local#

Can you tell what the problem is?

Now I am getting an internal server error when I navigate to the site.

When I add the ssl certificate, to site_json file I get the error above and internal server error.

Is it a permissions problem?

You probably missed a comma in your site_config.json

Thank you, that worked. I needed to put a common after the db password, and the first line of the ssl certificate.

Do you know how to force ssl?

Should I manually edit the nginx default site or is there another way?

Is the page still working?

Using the command

bench setup lets-encrypt sitename i get

nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
INFO:bench.utils:sudo systemctl start nginx
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/setup.py”, line 104, in setup_letsencrypt
setup_letsencrypt(site, custom_domain, bench_path=‘.’)
File “/home/frappe/.bench/bench/config/lets_encrypt.py”, line 42, in setup_letsencrypt
setup_crontab()
File “/home/frappe/.bench/bench/config/lets_encrypt.py”, line 89, in setup_crontab
user_crontab.write()
File “/usr/local/lib/python2.7/dist-packages/crontab.py”, line 335, in write
raise IOError(“Please specify user or filename to write.”)
IOError: Please specify user or filename to write.