Created
July 31, 2014 15:40
-
-
Save ProfFan/3765b1795cf74bf31c04 to your computer and use it in GitHub Desktop.
Force Full Site SSL with non-SSL redirecting
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 your-ip:80 default_server; | |
server_name ex1.ex.net; | |
server_name ex2.ex.net; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
ssl on; | |
ssl_certificate /certs/ssl.crt; | |
ssl_certificate_key /certs/ssl.key; | |
root /wwwroot; | |
server_name ex1.ex.net; | |
location / { | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header Host $host; # !IMPORTANT: Hard to debug | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_pass http://localhost:1234/; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment