1

I wanted to change from http to https in nodeJS. My .pem files come from Let's Encrypt and are actually properly embedded. The client gets a 500 status code. The console issues a "listen EACCES 0.0.0.0:443" unhandled error.

My http server worked on port 443, so I don't understand why this shouldn't work anymore. On other ports I get the error that this port is already occupied, although this is not the case. At first I thought it was the .pem files, but they are correctly linked and otherwise there would be a tendency to error, right?

//require https/ fs

const options = {
  key: fs.readFileSync('conf/DEV-KEY.pem'),
  cert: fs.readFileSync('conf/DEV-CERT.pem')
};

https.createServer(options, (req, res) => {
    res.writeHead(200);
    res.end("Hello World");
}).listen(443);

Client message: jquery.min.js:4 POST https://h2825492.stratoserver.net/register 500 enter image description here Server message: events.js:165 throw er; // Unhandled 'error' event ^ Error: listen EACCES 0.0.0.0:443

This question is not a duplicate, because Port 443 runs with my http Server - I don't know, why the Port should not work on https!?

enter image description here

lelek_jo
  • 11
  • 1
  • 3
  • 1
    Possible duplicate of [Error: listen EACCES 0.0.0.0:443](https://stackoverflow.com/questions/50112186/error-listen-eacces-0-0-0-0443) –  Oct 28 '19 at 19:23
  • I don't think so. My http server worked on PORT 443 without root permissions. – lelek_jo Oct 28 '19 at 19:59
  • 1
    but have you tried running the node with root? – Eric Wong Oct 29 '19 at 03:52
  • I use nodeJS with Plesk. I tried to login in Plesk with root permissions, but that didn't help. I don't know how i can run node with root via ssh when nodeJS is installed with Plesk. – lelek_jo Oct 29 '19 at 06:28

1 Answers1

1

just provide my solution: please check if your server's 443 port is already occupied. In my case, I have a personal used IIS server which occupies the 443 port, once I remove that port from IIS server bindings, my nodejs works.

Tyler Du
  • 11
  • 2