1

我们在使用 django、gunicorn、在 nginx 后面运行时上传到我的网站时遇到问题。我们还在应用服务器上安装了 gluster,文件在其中上传并在多个服务器上进行分布式复制。(所有层级都在 AWS 上)

当我们上传一个文件(~15mb)时,我们得到一个 502 Bad Gateway。我们还检查了显示upstream prematurely closed connection while reading response header from upstream, client. 我们的上传速度非常慢(<5k)。我们可以上传到其他网站就好了,我们的互联网上传大约是 10MB 和其他任何东西。

我是否缺少任何配置文件以允许通过 gunicorn 或 nginx 上传文件?

nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    server_names_hash_bucket_size 256;
    # server_name_in_redirect off;

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

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml          
    application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

conf.d 文件:

client_max_body_size 256m;

_

proxy_read_timeout 10m;
proxy_buffering off;
send_timeout 5m;

_

我们有一种感觉,它可能是 nginx 或 gluster 挂载。我们已经为此工作了好几天,并查看了 nginx 和 gunicorn 中的 timeout* 变量,但没有取得任何进展。

任何帮助将不胜感激,谢谢!

4

1 回答 1

2

所以,我们解决了这个问题。它与我们的任何代码、服务器设置或亚马逊无关。我们将其范围缩小到仅在我们的网络中上传的 linux 机器。防火墙中有一个“tcp 窗口缩放”错误,它在达到限制后重置上传。

感谢任何尝试过的人。

于 2014-09-20T00:10:40.833 回答