This site runs best with JavaScript enabled.

Setting up a Signed SSL Certificate on Nginx

How to add an SSL to a website running on nginx

I recently needed to update the SSL certificate on Below are the notes I took in the process for when I need to do it again in 5 years.

Step 1

Purchase an SSL certificate. I bought a cheap one from

Step 2

Create CSR (certificate signing request)

1openssl req -newkey rsa:2048 -nodes -keyout -out

Then print it out and copy it to your clipboard.

1cat envelopebudget.csr

Paste CSR into the namecheap admin area

Wait for approval email... submit approval.

SSL cert will be emailed to you in zip file

Step 3

Upload the zip file to your server using scp.


Unzip the file on your server.


Concatenate the primary certificates.

1cat envelopebudget_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt >> ssl-bundle.crt

Move all certs to /etc/ssl/localcerts.

1sudo mkdir /etc/ssl/localcerts
2sudo mv *.crt *.key *.csr *.zip /etc/ssl/localcerts

Make sure the following is in nginx. (See Setting up a Django Server with PostgreSQL, Nginx, Celery & RabbitMQ)

1ssl on;
2ssl_certificate /etc/ssl/localcerts/ssl-bundle.crt;
3ssl_certificate_key /etc/ssl/localcerts/;
4ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;

Restart nginx.

Discuss on TwitterEdit post on GitHub

Share article
Dustin Davis

Dustin Davis is a software engineer, people manager, hacker, and entreprenuer. He loves to develop systems and automation. He lives with his wife and five kids in Utah.

Join the Newsletter

Dustin Davis