customisable websocket path

This allows a server admin to proxy websockets through the same port
on which the web frontend is hosted.  The following snippet configures
nginx such that any upgrade request to the path /ws is proxied to a
local websocket server running on port 8080.

  upstream websocket {
    server localhost:8080;
  }

  server {
    listen 443;
    ...

    # websocket proxy
    location /ws {
      rewrite /ws/(.*)$ /$1 break;
      proxy_pass http://websocket;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
    }

    ...
  }

  map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
  }

The backend should be configured to host the websocket server on
127.0.0.1 only; the frontend would then be configured to connect to the
websocket server through port 80/443 (same as the web application) on
the path /ws.
make websocket port configurable