r/CloudwaysbyDO • • 4d ago

Question Can Cloudways Flexible / Lightning Stack support a Node.js WebSocket server behind Nginx?

I'm currently hosting a website on Cloudways Flexible using the Lightning Stack (Nginx-only), and I'm experimenting with an idea for a very light-weight multi-player browser game. I'd like to know whether anyone has successfully configured this on Cloudways Flexible.

Specifically:

  1. Can Nginx on Cloudways Flexible proxy WebSocket connections to a locally running Node.js application?
  2. Is WebSocket support available through the existing Cloudways configuration, or does it require custom Nginx configuration?
  3. Can this be accomplished without switching hosting plans or involving Cloudways support?
  4. Are there any restrictions on maintaining persistent WebSocket connections on Flexible hosting?
  5. Has anyone successfully run a multiplayer game or another real-time Node.js application this way?

I'd prefer to keep Node.js listening locally on 127.0.0.1 rather than exposing a separate public port. I'm not looking to move to another hosting provider or introduce a third-party service if this can be handled within my existing Cloudways setup. I'd appreciate hearing from anyone who has actually implemented this on Cloudways Flexible, particularly with the Lightning Stack.

2 Upvotes

1 comment sorted by

1

u/PoojafromCloudways 1d ago

Hey u/phpworm , Cloudways Flexible with the Lightning Stack is not designed to provide native, managed hosting for a persistent Node.js WebSocket server.

Although Nginx supports WebSocket proxying, the Lightning Stack is built around Nginx and PHP-FPM.

Running a custom Node.js process and configuring Nginx to proxy WebSocket connections would require additional configuration and process management that is not part of the standard Flexible hosting setup. For this use case, we recommend Cloudways Velocity, which provides managed Node.js hosting with PM2 and Nginx reverse proxy support, including WebSocket traffic.