nginx请求后关闭上游连接 [英] nginx close upstream connection after request
本文介绍了nginx请求后关闭上游连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要保持nginx和上游nodejs之间的连接。
I need to keep alive my connection between nginx and upstream nodejs.
刚刚编译并安装了nginx 1.2.0
Just compiled and installed nginx 1.2.0
我的配置文件:
upstream backend {
ip_hash;
server dev:3001;
server dev:3002;
server dev:3003;
server dev:3004;
keepalive 128;
}
server {
listen 9000;
server_name dev;
location / {
proxy_pass http://backend;
error_page 404 = 404.png;
}
}
我的程序(开发:3001 - 3004)检测到响应后,nginx关闭了连接。
My programe (dev:3001 - 3004) detect that the connection was closed by nginx after response.
推荐答案
文档指出对于http keepalive,你还应该设置 proxy_http_version 1.1;
和 proxy_set_header连接;
The documentation states that for http keepalive, you should also set proxy_http_version 1.1;
and proxy_set_header Connection "";
这篇关于nginx请求后关闭上游连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文