所以我为 nginx 设置了 tcp 模块,并尝试将它与 private_pub (faye) 一起用于 websockets。截至目前,我从 faye 和 502 Bad Gateway 错误中加载速度非常慢。每个人都指向这样配置它:
我的 nginx.conf 中有这个:
tcp {
timeout 1d;
websocket_read_timeout 1d;
websocket_send_timeout 1d;
upstream websockets {
server 199.36.105.34:9292;
check interval=300 rise=2 fall=5 timeout=1000;
}
server {
listen 9200;
server_name 2u.fm;
timeout 43200000;
websocket_connect_timeout 43200000;
proxy_connect_timeout 43200000;
so_keepalive on;
tcp_nodelay on;
websocket_pass websockets;
}
我已经尝试了网络上的所有变体。我希望能够从我的域“2u.fm/faye”中访问它,但我可以让它工作的唯一方法是在我的 http 块内做一个代理:
location /faye {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:9200;
break;
}
添加它使其在 2u.fm/faye 上工作,但现在我回到第一方,仍然得到超慢响应和 502 Bad Gateway。我认为这是有道理的,因为它仍然通过http而不是直接路由到tcp。我试过直接打 199.36.105.34:9200 但我没有得到回应。