我使用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,如果我刪除上游指令(我還沒有進行負載平衡)並在服務器標籤中添加代理服務器通行證,那我該怎麼辦? –