How to enable SSL certificate on Nginx

First of all, you have to check if your webserver version supports SSL. If SSL is not enabled in your server read more here

If the SSL module is installed in your Nginx instance then you have a few simple steps to follow.

  1. Generate Certificate Signing Request (CSR)
    • Generate private key
    • Login into the server by ssh
      openssl genrsa -out 2048
    • Generate the CSR
    • openssl req -new -key -out
  2. Create a backup of the private key in a secure place it will be useful
  3. Request Certificate – with the CSR generated above you can go to a provider to sign your certificate.
  4. Install the certificate
    • You have to receive the keys from your SSL certificate provider: your primary certificate and the intermediate certificate.
    • create one file with both files
    • Upload to the server in a safe place with read access for the root user
    • Edit your host configuration on Nginx
    • server {
              listen 443 default ssl;
              ssl_certificate      /etc/ssl/;
              ssl_certificate_key  /etc/ssl/;
       keepalive_timeout    70;
              # other configuration
    • Test your Nginx configuration and restart the service if everything is fine.
  5. Done