Created
November 3, 2011 16:45
-
-
Save sideshowcoder/1337018 to your computer and use it in GitHub Desktop.
Nginx forward all to https
This file contains hidden or 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 to forward all HTTP | |
server { | |
# replace a.b.c.d with IP | |
listen a.b.c.d:80; | |
location / { | |
if ($host ~* ^(example\.com|www\.example\.com)$ ) { | |
rewrite ^/(.*)$ https://example.com/$1 permanent; | |
} | |
# Nonstandard code 444 closes the connection without sending any headers | |
return 444; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment