I'm trying since some days to find a way to configure simultaneous websocket and web server connections with one same Apache Web Server I have on a shared hosting basis. Now, before giving that up and definitely switching to a dedicated hosting contract with my host, I want to be sure that this is actually not possible.

What I've tried so far:

Installing a reverse proxy in front of my web server, and create websocket chat application (most likely in node.js, tried with ratchet in PHP, but node seems to be the better choice) on the same apache server, listening on a different port than the web server. Problem: I have no root access, so I can't change the port at which my apache web server is listening, meaning that I can't actually "place" my NGINX reverse proxy in front of my web server.

What may works, but I have no idea how that works:

I found out about https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html, the extension for Websockets for Apache Servers, and may Apache version (2.4) of my web server would support that. However, can I actually 1) configure this extension without root access 2) use it to make simultaneous websocket & web server connections via my only apache web server work?

Thanks in advance for any help / other ways to may figure this out (guess the mod_proxy_wstunnel extension is kind of my last chane)!

  • You won't be able to do it with apache without root access, since you need to modify its configuration. Apache is certainly capable. May 20, 2020 at 10:26
  • Okay, so I was right and my host recommended BS. So, may I confirm this with you, when switching to a VPS hosting (with root access), that VPS server can indeed handle simultaneous web server and websocket connections; I don't need two servers (one for websockets and one for web serving) ? Simply need to configure the websocket application to listen on a different port than the web serving, right? Also, with the root access of the VPS, I'll be easily able to place an NGINX reverse proxy in front of the VPS, managing Websocket and web serving proxying, correct?
    – DevelJoe
    May 20, 2020 at 10:31
  • I don't understand why people would want to put an Nginx in front of an Apache. Enable the Apache mod and add a couple of lines to its configuration. Websocket app (which in itself is also a server) should of course listen on another port - only one server per IP:port. The WS traffic will continue to arrive on port 80 and be proxied by Apache to the websocket server/app. "The VPS server can indeed handle" ? I can't guarantee that, but Apache won't be the bottleneck. May 20, 2020 at 10:59
  • Ok cheers mate!
    – DevelJoe
    May 20, 2020 at 11:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.