【问题标题】:Slow uploads Nginx and Gluster缓慢上传 Nginx 和 Gluster
【发布时间】:2014-11-07 07:18:04
【问题描述】:

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

当我们上传一个文件(~15mb)时,我们得到一个 502 Bad Gateway。我们还检查了显示upstream prematurely closed connection while reading response header from upstream, client 的 nginx 日志。我们的上传速度非常慢(

我是否缺少任何允许通过 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* 变量,但没有取得任何进展。

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

【问题讨论】:

    标签: django amazon-web-services nginx gunicorn glusterfs


    【解决方案1】:

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

    感谢任何尝试过的人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-13
      • 1970-01-01
      • 2012-07-24
      • 1970-01-01
      • 2016-12-10
      • 1970-01-01
      • 2011-10-12
      • 2012-05-11
      相关资源
      最近更新 更多