Skip to content

Instantly share code, notes, and snippets.

@sideshowcoder
Created November 3, 2011 16:45
Show Gist options
  • Save sideshowcoder/1337018 to your computer and use it in GitHub Desktop.
Save sideshowcoder/1337018 to your computer and use it in GitHub Desktop.
Nginx forward all to https
# 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