0

Hi,

I am on a shared hosting and my SSL works just fine when I access my site like this: https://example.net but I have a node server running on port 3000 which I can only access like this: http://example.net:3000 but I want to access it via https as well. My server configuration file looks like this:

const app = require("express")();
const httpServer = require("http").createServer(app);

app.get('/', function (req, res, next) {
  res.sendFile(__dirname + '/index.html');
});

I found out that I have to include these files for the certificate:

var certificate = {
  key: fs.readFileSync('/etc/letsencrypt/live/example.com/privkey.pem'),
  cert: fs.readFileSync('/etc/letsencrypt/live/example.com/cert.pem'),
  ca: fs.readFileSync('/etc/letsencrypt/live/example.com/chain.pem')
};

for starters I dont know where to put this in my code and secondly I think I dont even have access to those files because I have no root access. What should I do?

Thank you.

Cain Nuke
  • 2,843
  • 5
  • 42
  • 65
  • possible duplicate of [How do I setup a SSL certificate for an express.js server?](https://stackoverflow.com/q/11804202/2659499) – Vahid Nov 04 '21 at 19:04
  • it doesnt answer my question on how to access the necessary files. – Cain Nuke Nov 04 '21 at 19:41
  • Does this answer your question? [How do I setup a SSL certificate for an express.js server?](https://stackoverflow.com/questions/11804202/how-do-i-setup-a-ssl-certificate-for-an-express-js-server) – Jan Garaj Nov 06 '21 at 18:41
  • Had already solved it but thank you anyway. – Cain Nuke Nov 06 '21 at 18:43

0 Answers0