Try ERPNext Buy Support Partners Foundation

Adding SSL To Server Error

Hello All

I am new to this software and nginx.

I installed the VM on my server and am able to connect to the site. Now i wish to add HTTPS.
My port 80 and 443 is blocked so first i used these commands to redirect.

Port based multitenancy

You can create a new site and make run it on a different port (while the first one runs on port 80).

Switch off DNS based multitenancy (once)

bench config dns_multitenant off

Create a new site

bench new-site site2name

Set port

bench set-nginx-port site2name 82

Re generate nginx config

bench setup nginx

Reload nginx

sudo service nginx reload

I made a new site (test.com). Then i installed lets encrypt ```
sudo apt install python-certbot-nginx

and did the manual dns challange and got my keys in etc/letsencrypt/live/test.com

Then i follow this guide : 




    Configure the certificates for your site(s)

    Go to your erpnext sites site_config.json

    $ cd frappe-bench/sites/{{ site_name }}

    Add the following two lines to your site_config.json

    "ssl_certificate": "/etc/letsencrypt/live/example.com/fullchain.pem",
    "ssl_certificate_key": "/etc/letsencrypt/live/example.com/privkey.pem"

    Regenerate the nginx configuration

    $ bench setup nginx

    Restart the nginx server

    $ sudo service nginx restart


Everything is working till i run the command bench setup nginx then i get this message:
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y


WARNING: The site config for the site test.com is broken. If you want this command to fail, instead of just showing a warning, You may add the 'strict_nginx' flag to common_site_config.json and set it to 1 


Port configuration list:

Site site1.local assigned port: 80




Anyone have any ideas?

Thanks in advance

Actually i just found the issue. In the site_config.json file i was missing one comma.

So now bench setup worked and i restarted nginx. But i get Secure Connection Failed error when i try to use https.

Http still works

Let me know if you have any ideas

Thanks!

This is my site_config.json file

{
“db_name”: “",
“db_password”: "
*”,
“db_type”: “mariadb”,
“nginx_port”: 10102,
“ssl_certificate”: “/etc/letsencrypt/live/test.com/fullchain.pem”,
“ssl_certificate_key”: “/etc/letsencrypt/live/test.com/privkey.pem”
}

Welcome to the ERPNext forum -

Please share here the complete error traceback found in logs/

You need to do something like this:

bench set-config host_name https://test.com

This may help with config tips How can I disable Auto Update System

I figured it out.

Thanks