Zest.

nginx: Redirect HTTP to HTTPS

A short, tested nginx example for redirect http to https. Copy it and adjust the names and paths for your project.

nginx
server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

Find it in Zest

Search for “nginx redirect http to https” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More nginx examples

All nginx examples