Enable https

admin
Site Admin
Posts: 12
Joined: Thu Oct 03, 2013 5:49 pm

Enable https

Postby admin » Fri Jun 18, 2021 9:19 am

in bin/www use:

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

const options = {
key: fs.readFileSync('ssl/Calisoft-ssl-certificate.key'),
cert: fs.readFileSync('ssl/calisoft_dev.crt'),
ca: fs.readFileSync('ssl/calisoft_dev.ca-bundle')
};

var port = normalizePort(process.env.PORT || '443');
app.set('port', port);

var server = https.createServer(options, app);

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

Return to “Node.js”

Who is online

Users browsing this forum: No registered users and 1 guest