nginx upload progresso me retorna sempre mesmo tamanho e recived

2

Eu configurei meu domínio de conteúdo estático nginx assim:

#  static0.mywebsite.com static1.mywebsite.com static2.mywebsite.com static3.mywebsite.com
server {

        # upload limit
        # upload_limit_rate 10240;

        # request size limitation
        client_max_body_size 500m;
        client_body_buffer_size 64k;

        # document root
        root /home/mywebsite/myns-projects/mywebsite_com/static/public/;

        # index file
        index index.php;

        # server name
        server_name  static0.mywebsite.com;

        # rewrite rules
        rewrite "^/thumbnail/([A-Za-z0-9]{12})/(.*)/.*$" /index.php?request=thumbnail&unique=$1&parameters=$2 last;

        # set myns no cache
        set $myns_no_cache 1;
        if ($request_uri ~* "/thumbnail\/.*/") {
                set $myns_no_cache 0;
        }
        if ($request_uri ~* "/serve\/.*\.(jpg|gif|png|swf)/") {
                set $myns_no_cache 0;
        }

        if ($request_uri ~* "/serve\/.*\.(jpg|gif|png|swf)/") {
                set $myns_no_cache 0;
        }

        # upload
        location /upload {
                # proxy to upstream server
                proxy_pass http://static0.mywebsite.com;
                proxy_redirect default;

                # track uploads
                track_uploads uploadproxied 10s;

                # mvc rewrite
                try_files $uri $uri/ /index.php?request=upload&$args;
        }

        # /
        location / {
                # expires
                expires max;

                # disable etag
                if_modified_since off;
                add_header 'Last-Modified' '';

                # mvc rewrite
                try_files $uri $uri/ /index.php?$uri&$args;
        }

        # progress
        location /progress {
                # report uploads tracked in the 'proxied' zone
                report_uploads uploadproxied;
        }

        # php5-fpm
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9003;
                fastcgi_param myns_PATH /home/mywebsite/myns;
                fastcgi_index index.php;
                fastcgi_read_timeout 300;
                include fastcgi_params;
                fastcgi_intercept_errors on;
                fastcgi_cache_bypass $myns_no_cache;
                fastcgi_no_cache $myns_no_cache;
                fastcgi_cache mynsCACHE;
                fastcgi_cache_valid any 1h;
        }

        # deny access to .htaccess and .user.ini files
        location ~ /\.[ht|user] {
                deny all;
        }

        # disable access log for better performace use at will
        # access_log /home/mywebsite/myns-projects/mywebsite_com/logs/static_access.log;
        access_log off;

        # logs
        error_log /home/mywebsite/myns-projects/mywebsite_com/logs/static_error.log;
}

Após enviar a resposta, o jsonp retorna bem, mas sempre received igual a size .

jQuery110109778769564112372_1428954161844({ "state" : "uploading", "received" : 2461040, "size" : 2461040 });

Versão do Nginx:

:~# nginx -V
nginx version: nginx/1.6.2
built by gcc 4.7.2 (Debian 4.7.2-5) 
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-file-aio --with-http_spdy_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/headers-more-nginx-module --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/naxsi/naxsi_src --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-auth-ldap --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-auth-pam --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-cache-purge --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-dav-ext-module --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-development-kit --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-echo --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/ngx-fancyindex --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-push-stream-module --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-lua --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-upload-progress --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-upstream-fair --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-syslog --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/ngx_http_pinba_module --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/ngx_http_substitutions_filter_module --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/ngx_pagespeed --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-x-rid-header --add-module=/usr/src/nginx/source/dotdeb-nginx/debian/modules/nginx-rtmp-module --with-ld-opt=-lossp-uuid
    
por sweb 13.04.2015 / 21:54

1 resposta

1

track_uploads syntax: track_uploads < zone_name> < timeout>

default: n/a

context: location

This directive enables tracking uploads for the current location. Each POST landing in this location will register the request in the zone_name upload progress tracker. Since Nginx doesn't support yet RFC 1867 upload, the location must be a proxy_pass or fastcgi location. The POST must have a query parameter called X-Progress-ID (or an HTTP header of the same name) whose value is the unique identifier used to get progress information. If the POST has no such information, the upload will not be tracked. The tracked connections are kept at most timeout seconds after they have been finished to be able to serve unseful information to upload progress probes. WARNING: this directive must be the last directive of the location. It must be in a proxy_pass or fastcgi_pass location. Repeating the directive in a location will results in segfaults.

Parece que o track_uploads deve ser a última diretiva no bloco de localização. Tente trocar suas diretivas track_uploads e try_files na localização /upload .

    
por 20.04.2015 / 16:32

Tags