我使用nginx version: nginx/1.0.12
Nginx的TCP(网页套接字)超时/保持连接配置
我的nginx.conf如下:
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
tcp {
upstream websockets {
## Play! WS location
server 127.0.0.1:9000;
check interval=3000 rise=2 fall=5 timeout=1000;
}
server {
listen 80;
listen 8000;
server_name socket.domain.com;
tcp_nodelay on;
proxy_pass websockets;
proxy_send_timeout 300;
}
# virtual hosting
#include /usr/local/nginx/vhosts/*;
}
我的应用程序似乎是下降的WebSocket connnections每75秒(左右)我认为这是因为Nginx的默认Keepalive配置。如何增加超时时间?
感谢
查看[wiki](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive)。 –
我以前曾尝试过:我在第20行添加了keepalive 32(在服务器127.0.0.1:9000下),并且在/usr/local/nginx/conf/nginx.conf中获得了nginx:[emerg]未知指令“keepalive”: 20 –
@DmitryPaskal,如果我删除上游指令(我还没有进行负载平衡)并在服务器标签中添加代理服务器通行证,那我该怎么办? –