title: Can't get WebSocket Server running on a subdomain (Plesk, Linux, NodeJs, Express)
body: <p>I’ve developed myself a little WebSocket Server which works perfectly (local - on my IDE). The problem is that I want to host it on my server managed with Plesk under a specific subdomain that I've created: <code>ws.my-url.de</code>.</p>
  
  <p>This is my <code>server.js</code> file:</p>
  
  <pre><code>const {logInfo}       = require('./logger');
  const WebSocketServer = require('ws').Server;
  const express         = require('express');
  const uuid            = require('node-uuid');
  
  const app = express();
  const wss = new WebSocketServer({
      server: app.listen(process.env.PORT || 8888)
  });
  
  logInfo('WebSocket Server successfully started');
  
  wss.on('connection', ws =&gt; {
      ws.id = uuid.v4();
  
      logInfo(`Client connected: ${ws.id}`);
  
      ws.on('message', function () {
          logInfo(`New message from client: ${ws.id}`);
      });
  
      ws.on('close', function () {
          logInfo(`Client: ${ws.id} closed connection`);
      });
  });
  
  wss.on('close', function () {
      logInfo('WebSocket Server stopped');
  });
  
  app.post('/', function (req, res) {
      logInfo(req);
  });
  </code></pre>
  
  <p>I've also implemented a logger that logs out to a file which works also great (directly on start e.g. my startup message) but inside the <code>logs</code> folder on my server is a yawning emptiness.</p>
  
  <p>I really can't get my WebSocket Server running on my server. To leave no stone unturned, I've <code>disabled the proxy mode</code> from <code>nginx</code> but after trying to connect to <code>wss://ws.my-url.de</code> I'm getting this error:</p>
  
  <pre><code>WebSocket connection to 'wss://ws.my-url.de/' failed: Error during WebSocket handshake: Unexpected response code: 500
  </code></pre>
  
  <p>So I can say that my server is not starting. To be really sure (and to exclude other things), I've wrote a little http server found in the internet and this ran straight out of the box after pressing the <code>Restart App</code> button (I saw the response in the browser window):</p>
  
  <pre><code>const http = require('http');
  
  http.createServer(function(request, response) {
    response.writeHead(200, {'Content-Type': 'text/html'});
    response.end('App is running…');
  }).listen(process.env.PORT);
  </code></pre>
  
  <p>This is my configuration by the way:</p>
  
  <p><a href="https://i.stack.imgur.com/cJPi2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cJPi2.png" alt="enter image description here"></a></p>
  
  <p>When I open the URL after trying to start my WebSocket Server, I'm getting this error:</p>
  
  <p><a href="https://i.stack.imgur.com/FgZic.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FgZic.png" alt="enter image description here"></a></p>
  
  <p>So what I'm doing wrong here? I don't want a page I can open, I just want to get this running as a little service which is accessible over my subdomain. I'm very overwhelmed with this and thankful for every person who can help me. </p>