[Tutorial] How to setup a purchased SSL certificate on erpnext site

[1] Generate CSRs (Certificate Signing Requests)
[1.1]Login to server where erpnext is installed
[1.2] command to generate csr with private key

openssl req -new -newkey rsa:2048 -nodes -keyout shop.mydomain.com.key -out shop.mydomain.com.csr

[1.3] 2 files are generated in directory where above command is run. shop.mydomain.com.key and shop.mydomain.com.csr
[1.4]Open shop.mydomain.com.csr in nano/text editor and copy its content

[2] Provide CSR to godaddy or from where u r purchasing certificate
[2.1] Go to SSL->Domain–>Rekey–>Provide CSR
[2.2] Download certificate ex 5771137810388d5.crt
[2.3] Rename file to shop.mydomain.com.crt
Above steps will differ based on from where it is purchased.

[3] Install certificate on your ERPNext server
[3.1] Go to ERPNext server. Upload shop.mydomain.com.crt and shop.mydomain.com.key to /etc/nginx/conf.d/ssl/
[3.2] Commands to run
[3.2.1]Setup Multitenancy. Ref Setup Multitenancy

bench config dns_multitenant on
bench setup nginx
sudo service nginx reload

[3.2.2] Update site_config.json with path of certificate and key. Ref Configuring HTTPS

bench set-ssl-certificate shop.mydomain.com /etc/nginx/conf.d/ssl/shop.mydomain.com.crt
bench set-ssl-key shop.mydomain.com /etc/nginx/conf.d/ssl/shop.mydomain.com.key
bench setup nginx
sudo service nginx reload

8 Likes

Awesome! Can you update docs if anything missing. Configuring HTTPS

1 Like

@saurabh6790, i have created pull request Update configuring-https.md by ashish-greycube · Pull Request #154 · frappe/frappe_io · GitHub.
Your steps are comprehensive and clear. I just added 2 things (a) CSR command (b) Prerequisite of multitenancy. Thanks

Some useful links in above process:

While generating CSR, key gets generated and you are asked different questions. Below link explains those question. important is Common Name

1 Like

Refer this link,