What I've Done
I used certbot
to certify that I own my domain, which generated several .pem
files. The certificates are listed here: https://certbot.eff.org/docs/using.html#where-are-my-certificates
I found this post which makes sense and matches all of the other information I'm getting from Googling around, but when I do this and run node I can't connect to my site using https. Http works fine as it always has.
My server is express.js + node.js and I'm not using a reverse proxy like nginx. It's running on Ubuntu on Google Cloud Platform.
The relevant code is:
var http = require('http');
var https = require('https');
var privateKey = fs.readFileSync('/etc/letsencrypt/live/troywolters.com/privkey.pem', 'utf8');
var certificate = fs.readFileSync('/etc/letsencrypt/live/troywolters.com/fullchain.pem', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var app = express();
// Lots of other express stuff (app.use()'s)
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
httpServer.listen(80);
httpsServer.listen(443);
What doesn't work
When I try to connect to my site using https://troywolters.com the connection times out and nothing happens. What am I doing wrong?