Created
March 22, 2014 22:34
-
-
Save thomasfr/9715456 to your computer and use it in GitHub Desktop.
Redirect all requests not matching server_name to `www.example.com`
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 { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
rewrite ^ http://www.example.com permanent; | |
} | |
server { | |
server_name www.example.com | |
root /usr/share/nginx/html; | |
index index.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment