Issue using webscokets over wss

You might find nginx documentation and https://forum.nginx.org/ helpful as well.

I did find a file that told me earlier but i cant remember which it was. So sorry all.. im new to this side of things. Ill try and find it again tomorrow and repost it here.

Ok guys i found these lines in some conf files:

And...

With nginx I find this more common, let's see what other say.

ssl_certificate      /etc/letsencrypt/live/<domain name>/fullchain.pem;
ssl_certificate_key  /etc/letsencrypt/live/<domain name>/private.key;

@Bruce5051 OP is using Plesk, the directory structure you're showing is that of Certbot, which is not necessarily the ACME client used by Plesk.

Looks like nginx is configured to use a single file for cert, chain and private key. Looking at TLS (SSL) | Node.js v21.2.0 Documentation I'm not sure Nodejs can handle that.

nginx uses the format:
ssl_certificate
The picture with:
SSLCertificateFile
is NOT for nginx [likely for Apache (or some variant)]

What file had the ssl_certificate?

nginx config isn't relevant unless your port 8080 service is proxied through nginx, if you are just running your own node server on port 8080 then nginx isn't involved for that.

Here is an example setting up node js for an ssl/tls enabled websocket:

You can likely feed it the same certificate pem file and key pem file that you use for your https service on the same domain. Be aware that your source file may be a symbolic link to the real file when using certbot to get certificates, not sure if that matters in this case. If in doubt copy the files first and try that.

Done some searching and looks like they are stored here: /usr/local/psa/var/modules/letsencrypt/etc/archive/

ill give it a go later and report back. Thanks all so much for helping so far.

Hurrah! Finally all sorted!

I had a couple of errors in the nodejs app which i fixed from the PM2 logs

I finally found the cert and key in the filepath named above so if anyone is running this VPS service from Ionos with Plesk thats where they are stored.

I used the following code with port 8080 as 8443 was already in use

// Minimal amount of secure websocket server
var fs = require('fs');

// read ssl certificate
var privateKey = fs.readFileSync('ssl-cert/privkey.pem', 'utf8');
var certificate = fs.readFileSync('ssl-cert/fullchain.pem', 'utf8');

var credentials = { key: privateKey, cert: certificate };
var https = require('https');

//pass in your credentials to create an https server
var httpsServer = https.createServer(credentials);
httpsServer.listen(8443);

var WebSocketServer = require('ws').Server;
var wss = new WebSocketServer({
    server: httpsServer
});

wss.on('connection', function connection(ws) {
    ws.on('message', function incoming(message) {
        console.log('received: %s', message);
        ws.send('reply from server : ' + message)
    });

    ws.send('something');
});

Thank you everyone for your help! especially webprofusion & osiris