LetsEncrypted Node.js HTTPS Server inaccessible from browser. Why it won't load?

Posted May 9, 2018 4.1k views
NginxNode.jsSecurityLet's Encrypt

I secured NGINX with SSL following this tutorial:

I explicitly chose to redirect all requests to HTTPS.

Now, when visiting my webpage, it correctly redirects me to and shows the default NGINX text.

I want Express to run there, so I made this tiny script to test things out:

var https = require('https');
var fs = require('fs');

var options = {
  key: fs.readFileSync('/etc/letsencrypt/live/'),
  cert: fs.readFileSync('/etc/letsencrypt/live/'),
  ca: fs.readFileSync('/etc/letsencrypt/live/')

https.createServer(options, function (req, res) {
  res.end("hello world\n");

The page will not load at all. What am I doing wrong?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

It sounds like https is set up properly but Nginx is not configured to use your Express app for requests for the https site. Can you share the contents of your configuration files in /etc/nginx/sites-enabled?