• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

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