Connecting to a WebSocket server via WebSocket Secure connection (wss://) on a Plesk based host.
As I'm going to have only one NodeJS, I prefer a subdomain: sockets.example.com
If you will have several NodeJS Apps you may want something like example.com/socket1
, example.com/socket2
, ...
As I will only use NodeJS on that subdomain, and I will redirect all traffic to NodeJS, it is safe to disable PHP
Turn that option off to stop using Apache
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Now you can run your NodeJS (on port 3000 for the above example)
You can also use Plesk's Node.js extension
This way you do not have to add additional nginx directives but you still have to disable proxy mode.