Linux : Configuring SSL certificate with Nginx

By | November 3, 2014

Setting up SSL certificate with Nginx is quite easy, however slightly differ from the standard configuration since it require that the server certificate and the certificate authority (CA) to be bundled together within a single PEM file.

NOTE : See this article if you are looking for the procedure how to generate a certificate key pair and certificate signing request (CSR).

1. Make sure all the components of your certificate (server private key, certificate and certificate authority) are within the same directory. I would suggest the following path :


2. Bundle both your certificate and CA together into a single PEM file using the following command :

cat your.domain.tld.crt certificate.authority.crt >> your.domain.tld.pem

3. Edit your Nginx SSL vhost configuration file :


4. Locate and edit the following statements to match your certificate :

ssl_certificate /etc/ssl/certs/your.domain.tld/your.domain.tld.pem;
ssl_certificate_key /etc/ssl/certs/your.domain.tld/your.domain.tld.key;

5. Restart Nginx daemon :

service nginx restart