• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Basic Guide for using NGINX with Web-Sockets

Max5593

New Pleskian
Hi,

after 2 days of research i didnt find any working solution to get access to my Nodejs Websocket server.

My Setup:
Nodejs Server with a regular API, listening on assigned Port (i.e. 33333) - everything works fine, every request goes through

On that same nodejs Server i also run a socket.io API which runs on another port (i.e. 22222). Concerning this Socket API i have no clue how to define the NGINX Plesk configuration.

Could somebody write down basic steps how to setup the NGINX Socket Conf?
Is it even possible to use sw-nginx (custom Plesk nginx version) with WebSockets?

Greetings Max
 

I also tried adding a location directive. It looks like the following:


==> This is the socket api
location /api1/ {
proxy_pass http://localhost:62646/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

==> This is the other classic and working api
location /api2/ {
proxy_pass http://localhost:62233/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

The big problem: The socket.io polling request displays error message 404 - Not found.
When i open the socket connect Url (http://myPleskDomainname/api1/) in my Browser it even displays the error response of my working api. Looks like there is a redirect to api2
 
Last edited:
Back
Top