Does Node.js on Plesk Onyx support WebSockets (




  • Avatar
    Generall Omosco (Edited )

    I'm getting the below error when trying to save the Additional Apache directives 

    "Invalid nginx configuration: nginx: [emerg] unknown directive "RewriteEngine" in /var/www/vhosts/system/ nginx: configuration file /etc/nginx/nginx.conf test failed"

  • Avatar
    Anzhelika Khapaknysh (Edited )

    Hi @Generall Omosco!

    I was able to get the same error when pasting rewrite rule into the "Additional nginx directives" field. 

    As mentioned rules are for Apache web server, make sure you paste them in the proper location (meanwhile, it worked for me):

  • Avatar
    George Moralis

    Hi, I have developed an application with web services endpoints and websocket support for live data streaming with Node.js. I've followed everything in your instructions,
    enabled the proxy_wstunnel (proxy was already enabled), added the rules for both HTTP and HTTPS and even tried the demo example but to no avail. With my code
    I was getting "connection reset by peer". Note that I redirect all the traffic to HTTPS. The HTTP/HTTPS part works OK, only the websockets part fails even with the
    demo from Phusion Passenger. Our version is Plesk Onyx 17.8.11 (Update #19). Any ideas what might be wrong?

  • Avatar
    Robert Asilbekov

    @George Moralis The example above assumes that the application is already running and listen port 4000. As it was mentioned in the article there are known issues with WebSockets on Apache + Passenger 

    To get the application work, just disable "Proxy mode" in "Websites & Domains > Apache & nginx Settings". Additionally,  due to passenger specifics, consider using dynamic port server.listen(process.env.PORT) instead of a static port.


  • Avatar
    Artur Beqiraj

    Hello, very interesting your tutorial, but I need your help, in my plesk panel I use this code. Because a soft I've, requires to work with ports 3000, but this software app requires that the server also handles WebSockets, because otherwise the app is not working anymore

    location ~ / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;


    What I would like to ask from you is: Is it possible to place a code in Additional nginx directives that can redirect the subdomain to the gates 3000 and handle WebSockets. If anyone is able to do it, I would be very grateful if you could give me some thought,


  • Avatar
    Alisa Kasyanova

    @Artur Beqiraj
    Such scenario was not tested officially and we have no documented solution for it.
    I suggest you address your question on our Forum, there are a lot of specialists that could advise you some solution.

Please sign in to leave a comment.

Have more questions? Submit a request