Created
September 21, 2016 03:09
-
-
Save gvarela/539adea6f11be62a45cb229c9b702e8b to your computer and use it in GitHub Desktop.
nginx with websockets for a local phoenix server
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 useful-api { | |
server 127.0.0.1:4000; | |
} | |
server { | |
listen 80; | |
server_name useful-api.dev; | |
client_max_body_size 100M; | |
try_files $uri/index.html $uri.html $uri @app; | |
location @app { | |
proxy_pass http://useful-api; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_http_version 1.1; | |
proxy_redirect off; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment