Last active
December 22, 2015 04:28
-
-
Save konklone/6416795 to your computer and use it in GitHub Desktop.
konklone.com ssl nginx configuration excerpt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
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