2014-09-13 50 views
1

我們在使用django,gunicorn,運行在nginx後面上傳到我的網站時遇到了麻煩。我們還在應用程序服務器上安裝了一個gluster加載程序,在該服務器上文件被上傳並分佈在多個服務器上。 (所有層都在AWS上)緩慢上傳Nginx和Gluster

當我們上傳一個文件(〜15mb)時,我們得到一個502 Bad Gateway。我們也檢查顯示upstream prematurely closed connection while reading response header from upstream, client的nginx日誌。我們的上傳速度非常慢(< 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的或蒼蠅座。我們一直在爲此工作數天,並且通過nginx和gunicorn中的timeout *變量查看了所有內容,並沒有取得任何進展。

任何幫助將不勝感激,謝謝!

回答

2

所以,我們解決了這個問題。它與我們的任何代碼,服務器設置或亞馬遜無關。我們將其縮小到僅限於在我們的網絡中上傳的Linux機器。在防火牆中有一個'tcp窗口縮放'的錯誤,它在達到限制後重置了上傳。

謝謝任何​​嘗試過的人。