Created
February 15, 2017 18:43
-
-
Save oguzhanaslan/7fff9765ee09a88c73ae1127e6d5692f to your computer and use it in GitHub Desktop.
nginx https, non-www redirect
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
#AUTOMATICALLY GENERATED - DO NO EDIT! | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
server_name oguzhan.in www.oguzhan.in; | |
if ($http_x_forwarded_proto = "http") { | |
return 301 https://$server_name$request_uri; | |
} | |
if ($host = 'www.oguzhan.in') { | |
return 301 https://$server_name$request_uri; | |
} | |
access_log /var/log/nginx/oguzhan.in.access.log; | |
error_log /var/log/nginx/oguzhan.in.error.log; | |
location / { | |
proxy_pass http://localhost:8080; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment