Skip to content

Instantly share code, notes, and snippets.

@konklone
Last active December 22, 2015 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konklone/6416795 to your computer and use it in GitHub Desktop.
Save konklone/6416795 to your computer and use it in GitHub Desktop.
konklone.com ssl nginx configuration excerpt.
server {
listen 80;
server_name konklone.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name konklone.com;
ssl_certificate /path/to/unified.crt;
ssl_certificate_key /path/to/my-private-decrypted.key;
}
# for a more complete, secure config:
# https://gist.github.com/konklone/6532544
@konklone
Copy link
Author

konklone commented Sep 2, 2013

This is an accompaniment to my blog post about setting up https:

https://konklone.com/post/switching-to-https-free-and-easy

See the advanced (and more secure) version of using HTTPS with nginx here:

https://gist.github.com/konklone/6532544

@konklone
Copy link
Author

konklone commented Sep 8, 2013

Also optional: if you proxy to a server (e.g. Sinatra), you'll want to pass the fact that it's https to that app, so it knows to preserve https on redirects. Otherwise, you'll get a mixed content warning after a https POST + http redirect + https redirect.

    # inside server block...

    location / {
       proxy_set_header X-Forwarded-Proto $scheme;

       # ...other proxy settings...
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment