首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >node服务器开启两个https端口,过一段时间卡死?

node服务器开启两个https端口,过一段时间卡死?

提问于 2020-02-10 22:13:10
回答 0关注 0查看 235

我用node开启了两个服务,在同一个服务器上,但是开启一段时间后就会出现内用大量内存卡死,然后我重启服务器还是不行,必须要关闭一个https服务才能正常,,,这是什么情况,具体 代码如下

开启一 var httpServer = http.createServer(app); var httpsServer = https.createServer({ key:fs.readFileSync(path.join(__dirname, './123.key'), 'utf8'), cert:fs.readFileSync(path.join(__dirname, './123.crt'), 'utf8') }, app);var PORT = 80; var SSLPORT = 443;httpServer.listen(PORT, function() { console.log('HTTP Server is running on: http://localhost:%s', PORT); }); httpsServer.listen(SSLPORT, function() { console.log('HTTPS Server is running on: https://localhost:%s', SSLPORT); });

开启二

var privateKey = fs.readFileSync(path.join(__dirname, './key/123.key'), 'utf8'); var certificate = fs.readFileSync(path.join(__dirname, './key/123.crt'), 'utf8'); var credentials = {key: privateKey, cert: certificate};var httpsServer = https.createServer(credentials, app);httpsServer.listen(8000, function() { console.log('HTTPS Server is running on: https://localhost:%s', 8000);})

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档