All guides
Web server / Installation

Install SSL on Nginx.

Install your full chain and key, validate the configuration, and reload safely.

Before you begin: use an issued production certificate and its matching private key. Back up the current configuration. Staging certificates are not publicly trusted.

1Place your certificate files

Upload fullchain.pem and privkey.pem to a restricted directory. Replace example.com with your own domain in every path and configuration.

Place your certificate files
sudo install -d -m 700 /etc/nginx/ssl/example.com
sudo install -m 600 privkey.pem /etc/nginx/ssl/example.com/privkey.pem
sudo install -m 644 fullchain.pem /etc/nginx/ssl/example.com/fullchain.pem

2Configure HTTPS

Merge these directives into the existing virtual host. Preserve your application's location blocks and document root. Confirm that port 443 is open.

Configure HTTPS
server {
    listen 443 ssl;
    server_name example.com www.example.com;

    ssl_certificate /etc/nginx/ssl/example.com/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    root /var/www/example.com;
    index index.html;
}

3Test and reload

Reload only after the configuration test succeeds. Add an HTTP-to-HTTPS redirect after HTTPS works, and schedule renewal before the actual certificate expiration.

Test and reload
sudo nginx -t && sudo systemctl reload nginx

Confirm the connection.

Check the installed certificate and chain, then keep an eye on the expiry date.

Open SSL Checker