【发布时间】:2017-01-22 01:56:29
【问题描述】:
我几乎尝试了任何可以在论坛和博客中找到的解决方案,但我运气不佳,这就是我现在寻求任何帮助的原因。
情况就是这样,我目前正在使用 Ubuntu,我在其中运行 2 个套接字,之前运行完美,但是当我尝试再添加 1 个套接字时出现问题(ERR_CONNECTION_TIMED_OUT)。
这是我在 NGINX 上为我的第三个套接字设置的
upstream stream {
server localhost:3210;
}
server {
location /socket.io {
proxy_pass http://stream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
这与我在第一个 2 应用程序中的 nginx 设置完全相同,这就是为什么我很难调试它,同样使用 nodejs 服务器。
http.listen(3210, function(){
console.log('Listening on Port 3210');
});
在前端
var socket = io.connect('http://testapp.com:3210');
【问题讨论】:
标签: node.js sockets nginx connection-timeout