如何在完全加载内容之前增加nginx超时?

时间:2016-10-18 17:12:34

标签: nginx dropwizard

我正在开发一个Web服务,其中Nginx用作代理,Dropwizard在后端。加载URL时出现问题,它没有加载超过2分钟的任何内容。最初是1分钟,所以我将proxy_read_timeout更改为3600s;

但是我增加了它,请求的开放时间不超过2分钟。 nginx错误日志显示以下错误,

2016/10/17 09:43:57 [error] 6#6: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.128.10, server: localhost, request: "GET /report-system/templates/Connection/csv/Transaction?params=PageNumber:1,PageSize:2000 HTTP/1.1", upstream: "http://127.0.0.1:8384/report-service/dev/reports/templates/Player_GlobalTransaction/render?connref=UpamMysql&format=csv&params=PageNumber:1,PageSize:2000", host: "api.website.com"

最有可能的错误不是使用dropwizard,而是仅使用nginx,因为当我在没有Nginx的情况下进行测试时,Web服务会一直打开,直到它完成加载页面为止。现在完全关闭2分钟

以下是nginx.conf的完整内容。

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;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    proxy_read_timeout 3600s;
}

一切都在不同的docker容器上运行。那么,在完全加载内容之前,保持连接打开的正确方法是什么?对此的任何帮助将不胜感激。

0 个答案:

没有答案