node.js https示例,错误,与localhost连接的未知SSL协议错误 [英] node.js https example ,error, Unknown SSL protocol error in connection to localhost

查看:276
本文介绍了node.js https示例,错误,与localhost连接的未知SSL协议错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这些链接中的简单示例:

I use simple example from these link:

一个链接 [如何在Node.js中创建HTTPS服务器?]

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

一个链接 [a如何创建https服务器? docs.nodejitsu.com]

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

但我得到的错误如

卷曲:(35)未知的SSL协议错误与localhost相关:-9838

curl: (35) Unknown SSL protocol error in connection to localhost:-9838

为什么?

推荐答案

我使用错误的方法创建证书。

I use the wrong way to create certificate.

这个错误:

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

这篇关于node.js https示例,错误,与localhost连接的未知SSL协议错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆