Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在最新节点下与Express server的SSL握手失败&;NPM_Node.js_Ssl_Express_Https - Fatal编程技术网

Node.js 在最新节点下与Express server的SSL握手失败&;NPM

Node.js 在最新节点下与Express server的SSL握手失败&;NPM,node.js,ssl,express,https,Node.js,Ssl,Express,Https,我将Mac上的Node.js升级到最新版本0.12.4,将NPM升级到2.10.1,并为我的Express项目重新运行了NPM安装 现在,当我访问时,我在Chrome中看到“此网页不可用/错误连接被拒绝”。当我运行curl-v时https://localhost:3001我明白了 curl -v https://localhost:3001/ * Hostname was NOT found in DNS cache * Trying ::1... * Connected to localh

我将Mac上的Node.js升级到最新版本0.12.4,将NPM升级到2.10.1,并为我的Express项目重新运行了NPM安装

现在,当我访问时,我在Chrome中看到“此网页不可用/错误连接被拒绝”。当我运行
curl-v时https://localhost:3001
我明白了

curl -v https://localhost:3001/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 3001 (#0)
* Server aborted the SSL handshake
* Closing connection 0
curl: (35) Server aborted the SSL handshake
这肯定是升级Node.js的结果,因为升级后问题立即出现

我是这样开始我的服务的:

options = {
    key: fs.readFileSync('sslkey.pem'),
    cert: fs.readFileSync('sslcert.pem')
};
http.createServer(app).listen(settings.apiPort);
https.createServer(options, app).listen(settings.apiSSLPort);
console.log('Listening on ports: ' + settings.apiPort + ' and ' + settings.apiSSLPort);

有人知道是什么导致了这个问题吗?

我也有同样的问题,试试这个:

options = {
        key: fs.readFileSync('sslkey.pem', 'utf-8'),
        cert: fs.readFileSync('sslcert.pem', 'utf-8'),
        ca: fs.readFileSync(<CA_FILE>, 'utf-8'),
        requestCert: true,
        rejectUnauthorized: false
    };
选项={
关键字:fs.readFileSync('sslkey.pem','utf-8'),
证书:fs.readFileSync('sslcert.pem','utf-8'),
ca:fs.readFileSync(,'utf-8'),
requestCert:对,
拒绝:错误
};

尝试不同的浏览器并清除缓存。curl-k-v有什么作用https://localhost:3001/show?
-k
选项告诉
curl
无论如何都允许“不安全”连接。这与
-v
选项相结合,将有助于提供有关服务器正在使用的证书的更多信息。或者,您可以使用
openssl s\u client-connectlocalhost:3001
。有趣的部分是确定在SSL握手过程中,连接何时关闭。