所以我的 app.js
文件中有以下代码:
http.createServer(function(request, response) {
// code
}).listen(80);
// var options = ...
https.createServer(options, function (request, response) {
// code
}).listen(443);
如何使用集群在单个进程中运行两个服务器对象?
谢谢
最佳答案
Cluster API实际上将运行 2 个服务器作为 2 个进程。这个问题听起来应该是“如何配置 connect
或 express
来监听 2 个端口”
关于node.js - 如何使用 cluster 和 node.js 运行 HTTP 和 HTTPS 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7509372/