Skip to content

Instantly share code, notes, and snippets.

@gvarela
Created September 21, 2016 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gvarela/539adea6f11be62a45cb229c9b702e8b to your computer and use it in GitHub Desktop.
Save gvarela/539adea6f11be62a45cb229c9b702e8b to your computer and use it in GitHub Desktop.
nginx with websockets for a local phoenix server
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