Skip to content

Instantly share code, notes, and snippets.

@chvanikoff
Created May 11, 2016 23:15
Show Gist options
  • Save chvanikoff/c3900124b0645ceee98a96a817b9568f to your computer and use it in GitHub Desktop.
Save chvanikoff/c3900124b0645ceee98a96a817b9568f to your computer and use it in GitHub Desktop.
upstream index {
server 127.0.0.1:4200;
}
upstream app1 {
server 127.0.0.1:4201;
}
upstream app2 {
server 127.0.0.1:4202;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
map $request_uri $app {
default "index";
"~^/(?P<p>[^/]*).*" $p;
}
server {
listen 80;
server_name sub.domain.com;
location / {
rewrite ^/[^/]*/?(.*) /$1 break;
include proxy_params;
proxy_redirect off;
proxy_pass http://$app;
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