pid /tmp/nginx.pid; error_log /dev/null; events { worker_connections 1024; } http { index index.html; access_log off; map $http_upgrade $type { websocket "socket"; default "web"; } server { listen 7889 default_server; server_name _; root /config/html; index index.html; access_log off; location / { try_files /nonexistent @$type; } location @web { sub_filter 'WebSocket(str)' 'WebSocket(window.location.href.split("#")[0].replace(window.location.protocol, window.location.protocol == "https:" ? "wss://" : "ws://"))'; sub_filter_once on; try_files $uri $uri/ =404; } location @socket { proxy_pass http://localhost:7890; proxy_connect_timeout 1d; proxy_send_timeout 1d; proxy_read_timeout 1d; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } } }