Ratchet is running on the server, listening to port 8080. There is apache, which has been added to the config:

ProxyPass / wss2 / ws: // my-site.com: 8080 /

From the client’s side, I’m connecting to wss: //my-site.com/wss2/. Everything is working. I put nginx. I add to his config:

upstream websocket { server 127.0.0.1:8080; } server { ... listen 443 ssl; location /wss2/ { proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 

When connecting via wss: // my-site.com/wss2/ I get 503 Service Unavailable. I tried instead of 127.0.0.1 to substitute my site.com, I cleaned the upstream section altogether, when connected I indicated the port number. The result is the same.

What am I doing wrong?

  • Config worker. Is nginx version> 1.3.13? after editing nginx config reboot? - Total Pusher
  • one
    Try to put a slash in the proxy_pass at the end - Alexey Ten
  • @total config working, version 1.12.2, rebooted - cdrw3
  • @AlexeyTen tried, did not help - cdrw3
  • Skopipastil config, checked, it works for me. 1) make sudo nginx -t , should output that everything is in order. 2) Turn on the error log and see what falls into it, exhaust here. 3) let's look for an error at the junction nginx => 8080. Similarly, your back-server works at ws://мой-сайт.com:8080/wss2/ - note that it is /wss2/ , and not / ? - Total Pusher

0