i have plesk server with apache2 and nginx and i have a websocket app it works on port 2589 and i used ratchet and autobahn to work with websocket,
nginx version
nginx version: nginx/1.20.2
and ufw status
Status: inactive
and my nginx directive config for websocket
location ^~ /WsConn
{
add_header 'Access-Control-Allow-Origin' '*';
proxy_pass http://localhost:2589;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Client-Verify SUCCESS;
proxy_set_header X-NginX-Proxy true;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
my js to connect to ws
new ab.Session(
'wss://domain.com/WsConn',
function() {
console.log('Connected!');
}
function() {
console.warn('SOCKET DISCONNECTED, WAIT NOW!!');
}, {
'skipSubprotocolCheck': true
}
and i keep getting connection failed in my browser

btw it was works so fine on my old VPS and there was some settings inside the directive config for nginx that made it worked, but when i moved on new VPS i lost this settings, so i hope if someone can help me setup the perfect settings for it again to make it accept websocket requests.
thanks.
EDIT: i found this errors in proxy_error.log
2022/08/23 19:25:17 [error] 175835#0: *2873868 upstream prematurely closed connection while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: domain.com, request: "GET /WsConn?sessid=mrgk7rg627morchjqml982iug2&&tk=8f45d30d6899f54d8f6c54886cd00286&&uid=1&&isios=0 HTTP/1.1", upstream: "http://127.0.0.1:2589/WsConn?sessid=mrgk7rg627morchjqml982iug2&&tk=8f45d30d6899f54d8f6c54886cd00286&&uid=1&&isios=0", host: "www.domain.com"
2022/08/23 19:25:17 [error] 175835#0: *2873868 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: domain.com, request: "GET /WsConn?sessid=mrgk7rg627morchjqml982iug2&&tk=8f45d30d6899f54d8f6c54886cd00286&&uid=1&&isios=0 HTTP/1.1", upstream: "http://[::1]:2589/WsConn?sessid=mrgk7rg627morchjqml982iug2&&tk=8f45d30d6899f54d8f6c54886cd00286&&uid=1&&isios=0", host: "www.domain.com"