Certificate Installation : Node.js in Linux

 Before configuring the SSL with node.js, please ensure that you have your 'Private Key', 'Certificate' and 'Intermeidate(s)' certificates. You might have received the following certificates from COMODO.

1) your_domain_name.crt (or) OrderNumber.crt - It is your Server Certificate

2) Intermediate Certificates, it depends upon the type of Certificate you purchase. Mostly, you will get them in the following format.

Ex: 'COMODORSAXXXXXXXXXSecureServerCA.crt' and 'COMODORSAAddTrustCA.crt'

Note: You may have received a .ca-bundle file, which includes those Intermediate Certificates. In this case, please download the appropriate certificate from Downloads.

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 = {
key: fs.readFileSync("/path/to/private.key"),
cert: fs.readFileSync("/path/to/your_domain_name.crt"),
ca: [

https.createServer(options, function (req, res) {
res.end("Welcome to Node.js HTTPS Servern");

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.




(7 vote(s))
Not helpful

Comments (0)