node.js https example ,error, Unknown SSL protocol error in connection to localhost

后端 未结 1 1221
一向
一向 2020-12-23 17:37

I use simple example from these link:

a link[a How to create an HTTPS server in Node.js?]

a link[a How to create an https server? docs.nodejitsu.com]

<
相关标签:
1条回答
  • 2020-12-23 18:41

    I use the wrong way to create certificate.

    This one is wrong:

    openssl genrsa -out key.pem
    openssl req -new -key key.pem -out csr.pem
    openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem
    

    This is the way to create certificate that could use:

    openssl genrsa -out client-key.pem 2048
    openssl req -new -key client-key.pem -out client.csr
    openssl x509 -req -in client.csr -signkey client-key.pem -out client-cert.pem
    
    0 讨论(0)
提交回复
热议问题