上游过早关闭连接,同时从上游读取响应头,用于节点和nginx的大请求

时间:2017-07-03 16:14:05

标签: node.js nginx pm2

您好我有一个节点应用程序,它与nginx一起作为反向代理,如果我想访问我的应用程序中的会话99,这是相当大的,我在nginx中有这些错误:

2017/07/03 13:09:56 [warn] 199#199: *118 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/5/00/0000000005 while reading upstream, request: "GET /api/organisme_formation/ HTTP/1.1", upstream: "http://172.17.0.2:5000/api/organisme_formation/",
2017/07/03 13:10:03 [warn] 199#199: *122 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/6/00/0000000006 while reading upstream, client: 92.154.49.177, 
2017/07/03 13:10:09 [error] 199#199: *118 upstream prematurely closed connection while reading response header from upstream, request: "GET /api/session?eq=id.99 HTTP/1.1", 

在网络浏览器中,我有一个502坏网关:

Failed to load resource: the server responded with a status of 502 (Bad Gateway)

回复标题:

Connection:keep-alive
Content-Length:576
Content-Type:text/html
Date:Mon, 03 Jul 2017 14:35:11 GMT
Server:nginx/1.11.10

这是我的nginx配置文件:

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
    client_max_body_size 0m;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

我尝试了这种配置:

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 0m;
large_client_header_buffers 2 1k;

但它也不起作用。

我用pm2检查了我的后端,我有这个错误:

PM2        | App [index] with id [0] and pid [258], exited with code [0] via signal [SIGKILL]
PM2        | Starting execution sequence in -fork mode- for app name:index id:0
PM2        | App name:index id:0 online

0 个答案:

没有答案