Configure Nginx for Serving HTTPS

TurnKey Internet - Dedicated Server - Dual Hexa-Core - Best Value Deal

In our previous article we've created self signed certificates to serve ssl traffic via cloudflare Full SSL. Now we can create Nginx Server Configuration to use the two certificate files server.crt and server.key for allowing https and also to enable https (port 443) to serve https traffic to our site. To do so, append the following server block in the file /etc/nginx/sites-available/default:

server
{
    listen 443;
    ssl    on;
    ssl_certificate  /usr/ssl/server.crt;
    ssl_certificate_key  /usr/ssl/server.key;

    /*YOUR OTHER CONFIGS for SITE GOES HERE*/
}

Now reload your nginx configuration:

sudo service nginx reload
TurnKey Internet - Cloud Servers - Best Value Deal