I have an apache instance running where 150 clients use long polling on some PHP scripts to receive updates about new files that have been uploaded. This of course creates 150 Apache threads. Now it seems the web server is at its limit (its an 10 year old machine) and I don't want to carry this baggage over to a new server.
I am thinking about using a WebSocket server that would handle the use case more effecient, but wonder, if 150 clients accessing the Apache which forwards the requests to my WebSocket server would also produce so many apache threads or if there is a more efficient way to handle it.
I cannot replace the Apache, just maybe with nginx because it also has to provide a homepage. I cannot use another port for the WebSocket server because this would mean I have to discuss update firewall rules with about 100 customers. Is this solvable?
You can probably put Nginx in front of it as a proxy. You then configure it to forward normal traffic to Apache, and use a special path for the websocket so that you can make an Nginx block that proxies that to your websocket server.
So you'll have two blocks:
Locations are matched by specificity, not order.