-
-
Save AD7six/75f1638740c307fc6c50 to your computer and use it in GitHub Desktop.
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
root@h5bp:~# cat /etc/nginx/sites-enabled/nginx | |
server { | |
listen 80; | |
server_name ~^(www\.)(?<domain>.+)$; | |
return 301 $scheme://$domain$request_uri; | |
} | |
server { | |
listen 80 default_server; | |
return 301 $scheme://www.$host$request_uri; | |
} | |
root@h5bp:~# exit | |
logout | |
Connection to 10.10.10.12 closed. | |
andy@work:~$ curl -I -H "host: example.com" http://10.10.10.12/asdfasdf?foo=bar | |
HTTP/1.1 301 Moved Permanently | |
Server: nginx | |
Date: Mon, 17 Nov 2014 13:39:27 GMT | |
Content-Type: text/html | |
Content-Length: 178 | |
Connection: keep-alive | |
Location: http://www.example.com/asdfasdf?foo=bar | |
andy@work:~$ curl -I -H "host: www.example.com" http://10.10.10.12/asdfasdf?foo=bar | |
HTTP/1.1 301 Moved Permanently | |
Server: nginx | |
Date: Mon, 17 Nov 2014 13:39:31 GMT | |
Content-Type: text/html | |
Content-Length: 178 | |
Connection: keep-alive | |
Location: http://example.com/asdfasdf?foo=bar | |
andy@work:~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment