V
V
vetsmen2017-02-14 01:49:33
JavaScript
vetsmen, 2017-02-14 01:49:33

Socket proxying through nginx?

Good day. How to properly proxy sockets through nginx? I found some ways on the Internet, I do it like this:

server {
  listen   80;

  server_name site.ru;

  location / {
        proxy_pass http://***.***.***.***:8080;
        proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

    location ^~ /public/ {
        root /srv/webapp;
    }
}

He doesn't want to work, for the life of me. Nginx produces statics normally, redirects requests to node.js just as well, but trouble with sockets. What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wexter, 2017-02-14
@Wexter

add proxy_send_timeout and proxy_read_timeout

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question