简体   繁体   中英

node.js cluster with https

I'm using the cluster npm for my node app.

var cluster = require('cluster');
var app = express.createServer({
    key: fs.readFileSync('privatekey.pem'),
    cert: fs.readFileSync('certificate.pem')
});

cluster(app)
 .use(cluster.logger('logs'))
 .use(cluster.stats())
 .use(cluster.pidfiles('pids'))
 .use(cluster.cli())
 .listen(443);

But I got the Permission denied when I use port 443. It's working fine if I use another port . Obviously 443 is dedicated to https, so how can I use it for my app ?

By default node can't access lower ports (unless you're root ). Don't be afraid though since any port will do.

The one usually used for development purposes is 8443 :

 .listen(8443);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM