Is there a way to compile nginx to handle reverse proxying websockets requests? I'm building a realtime app in Node.JS and need a web server on top of this. Everything I've read says Nginx cannot reverse proxy websockets requests, so I'm a little confused on how I should approach this problem.
I was thinking about just implementing all server logic in Node, but there are some problems with this approach
1) PHP - I need a way to serve PHP files 2) Static files - I really like that nginx is very fast for static files. There are some modules for this, though, so this problem isn't too big. 3) When I need to update my Node app, I would like to be able to restart that part separately from the main server. Also, if the Node app crashes for some reason, I don't want the whole web server to go down!
The simplest solution would be to setup virtual hosts in nginx for multiple subdomains and run each service on a separate one. That way you don't have to worry about distinguishing websockets requests from standard http requests on the same port.
Also, you can run php behind nginx using PHP-FPM but that's quite a challenge to get working, and for that reason Apache may be a better choice.