How to fix missing an Intermediate/chain certificate in nodejs

前端 未结 1 1621
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 09:08

I have installed nodejs and ssl on my sever

and my app.js code

var sslOptions = {
  key: fs.readFileSync(\'/etc/ssl/private/private.key\'),
  cert:         


        
1条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 09:19

    Comment out the line where you add the ca bundle. Copy all the text from ca.crt and paste them in cert.com.crt(don't replace the previous cert, just paste under it). It should work fine now.

    var sslOptions = {
      key: fs.readFileSync('/etc/ssl/private/private.key'),
      cert: fs.readFileSync('/etc/ssl/certs/cert.com.crt'),
      requestCert: true,
      //ca: fs.readFileSync('/etc/ssl/certs/ca.crt'),
      rejectUnauthorized: false 
    };
    
    var secureServer = https.createServer(sslOptions,app).listen(443, function(){
       console.log("Express server listening on port ");
    
    });
    

    0 讨论(0)
提交回复
热议问题