• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How do you enable WebSockets for nodejs and nginx

MeekSqueek

New Pleskian
Hi Forum members,

I need to enable websockets for a nodejs application. The server is Centos 6 with Nginx and Nodejs4. I've tried to add some directives to the nginx config:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://socket_nodes;

But "proxy_pass" directive is not allowed...

Any pointers would be gratefully received.

Thanks in advance.
 
Hi,

Did you find a solution for this ?
I'm facing the same problem, I didn't know the "proxy_pass" directive was not allowed,
But even if it were, how do you know where to proxy to ? ie: http://socket_nodes, where is that defined?
 
Hi,

Did you find a solution for this ?
I'm facing the same problem, I didn't know the "proxy_pass" directive was not allowed,
But even if it were, how do you know where to proxy to ? ie: http://socket_nodes, where is that defined?

I didn't find a solution to this but I did find a work around.

I turned off Proxy Mode (Nginx proxies requests to Apache. Turn off to stop using Apache.) as I had read somewhere that Apache doesn't support sockets. This causes the site to be served by nginx and passenger running within nginx and now it works a treat.

Have a go by turning off Proxy Mode in the Apache & nginx Settings page under the nginx settings area. If it works for you please add a reply to that effect. :)

Thanks

Simon.
 
Back
Top