Knowledgebase: SSL
Certificate Installation : Node.js in Linux

 

1. Create an https_server.js file using the following values. you can create file with any name using .js extension.

# vim https_server.js

 

var https = require('https');
var fs = require('fs');
var https_options = {
ca: fs.readFileSync("/path/to/mydomain.ca-bundle"),
key: fs.readFileSync("/path/to/server.key"),
cert: fs.readFileSync("/path/to/mydomain.crt")
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("Welcome to Node.js HTTPS Servern");
}).listen(8443)

2. Now use the following command to start node.js application created in above step.

# node https_server.js

 

3. To verify the installation, you can use our SSL Analyzer.

(1631 vote(s))
Helpful
Not helpful
Comments (0)