Table of Contents

About

This article shows you how to configure SSL (https) for the nginx web server

Prerequisites

You should know the basic of SSL for a server: How to enable SSL on a server (ie HTTPS on a web server) ?.

Configuration

When you got:

  • your certificate
  • and the private key

you can configure it 1) like that inside a server block

http {
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;
    
    server {
        listen              443 ssl;
        server_name         www.example.com; # the uri
        ssl_certificate     www.example.com.crt; # the certificate (public)
        ssl_certificate_key www.example.com.key; # the private key
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2; # the ssl version
        ssl_ciphers         HIGH:!aNULL:!MD5; # the ciphers
        ...
    }
    
}

where: