Last active
May 19, 2020 00:47
-
-
Save markgarrigan/e4f7e2baaf085c4382a59478c5dea774 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_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
upstream {{name}} { | |
server {{name}}; | |
} | |
upstream websocket { | |
server {{name}}:{{hot}}; | |
} | |
server { | |
listen 80; | |
server_name {{name}}.loc; | |
location / { | |
proxy_pass http://{{name}}; | |
} | |
} | |
server { | |
listen 80; | |
server_name ws.{{name}}.loc; | |
location / { | |
proxy_pass http://websocket; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
proxy_set_header Host $host; | |
} | |
} |
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_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
upstream {{name}} { | |
server {{name}}; | |
} | |
upstream websocket { | |
server {{name}}:443; | |
} | |
server { | |
listen 80; | |
server_name {{name}}.loc; | |
# Redirect all traffic to SSL | |
rewrite ^ https://$server_name$request_uri? permanent; | |
} | |
server { | |
listen 443 ssl; | |
server_name {{name}}.loc; | |
ssl_certificate /service/app/certs/{{name}}.loc+1.pem; | |
ssl_certificate_key /service/app/certs/{{name}}.loc+1-key.pem; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
location / { | |
proxy_pass http://{{name}}; | |
} | |
} | |
server { | |
listen 443 ssl; | |
server_name ws.{{name}}.loc; | |
ssl_certificate /service/app/certs/{{name}}.loc+1.pem; | |
ssl_certificate_key /service/app/certs/{{name}}.loc+1-key.pem; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
location / { | |
proxy_pass http://websocket; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
proxy_set_header Host $host; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment