nginx上传进度返回我总是相同的大小和recived

我设置我的nginx静态内容域如下所示:

# 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; } 

提交响应后,jsonp返回的好,但总是received相同的size

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

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 

track_uploads语法 :track_uploads <zone_name> <timeout>

默认 :不适用

上下文 :位置

该指令可以跟踪当前位置的上传。 在此位置的每个POST登陆将在zone_name上传进度追踪器中注册请求。 由于Nginx不支持RFC 1867上传,所以该位置必须是proxy_pass或fastcgi位置。 POST必须具有名为X-Progress-ID(或具有相同名称的HTTP标头)的查询参数,其值是用于获取进度信息的唯一标识符。 如果POST没有这样的信息,上传将不被跟踪。 被跟踪的连接在完成后最多可以保留几秒钟,以便能够提供不合适的信息来上传进度探测器。 警告:此指令必须是位置的最后一个指令。 它必须位于proxy_pass或fastcgi_pass位置。 在某个位置重复该指令将导致段错误。

所以看起来track_uploads必须是位置块中的最后一个指令。 尝试在/upload位置切换您的track_uploadstry_files指令。