Last active
May 22, 2016 03:19
-
-
Save donmccurdy/53033e5675512fce59525e58f620cd8c to your computer and use it in GitHub Desktop.
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
map $http_host $subdomain_port { | |
hostnames; | |
www.donmccurdy.com 8001; | |
sandbox.donmccurdy.com 8002; | |
proxy-controls.donmccurdy.com 8003; | |
} | |
server { | |
server_name _; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name donmccurdy.com; | |
root /home/donmccurdy/public; | |
access_log /var/log/nginx/donmccurdy.log; | |
error_log /var/log/nginx/donmccurdy.error.log; | |
ssl_certificate <cert>; | |
ssl_certificate_key <key>; | |
if ($subdomain_port = "") { | |
return 302 https://www.donmccurdy.com$request_uri; | |
} | |
location / { | |
try_files $uri @proxy; | |
} | |
location @proxy { | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_pass http://127.0.0.1:$subdomain_port; | |
proxy_redirect off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment