Why doesn't socket.io on nginx?

Set up a server on express.js + angular.js + socket.io.

Locally everything works. Deploy to server (nginx), a reference to the client /socket.io/socket.io.js.
Respectively, and everything else is also not working.
My nginx configuration for the site:

upstream web-portal{
 server 127.0.0.1:5050;
 keepalive 15;
}

server {
 listen 80;
 server_name demo.site.ru;
 access_log /var/log/nginx/web-portal.log;

 location / {
 proxy_pass http://web-portal;

 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "upgrade";

 proxy_set_header Host $http_host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

 location /socket.io/ {
 proxy_pass http://web-portal;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection $connection_upgrade;
 "proxy_redirect" off;

 proxy_buffers 8 32k;
 proxy_buffer_size 64k;

 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $http_host;
 proxy_set_header X-NginX-Proxy true;
}

 location ~* \.(?:jpg|jpeg|gif|png|css|js)$ {
 root /var/projects/web.portal/current/public;
}
}
July 8th 19 at 11:51
1 answer
July 8th 19 at 11:53
Solution
Solved the problem, hopefully someone else will come in handy.
My configuration file for your site:
upstream web-portal {
 server 127.0.0.1:5050;
 keepalive 15;
}

server {
 listen 80;
 server_name demo.portal.ru;
 root /var/projects/web.portal/current/public;
 access_log /var/log/nginx/web-portal.log;
 error_log /var/log/nginx/web-portal.error.log;

 location / {
 proxy_pass http://web-portal;

 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "upgrade";

 proxy_set_header Host $http_host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

 location ^~ /socket {
 rewrite ^/socket/(.*) /$1 break; #used to send request to base url
 proxy_pass http://web-portal;
 "proxy_redirect" off;
 proxy_pass_request_headers on;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header Host $http_host;
 proxy_set_header X-NginX-Proxy true;
 proxy_set_header X-Forwarded-Host $host;
 proxy_set_header X-Forwarded-Server $host;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "upgrade";
 proxy_set_header Host $Host;

}

 location ~* \.(?:jpg|jpeg|gif|png|css|js)$ {
 expires 30d;
}
}

Find more questions by tags Express.jsNginxSocket.io