I set my nginx static content domain like this:
# 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¶meters=$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;
}
After submitting response the jsonp return well but always received
equal as size
.
jQuery110109778769564112372_1428954161844({ "state" : "uploading", "received" : 2461040, "size" : 2461040 });
Nginx Version:
:~# 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
So it seems that the track_uploads must be the last directive in the location block. Try switching your
track_uploads
andtry_files
directives in the/upload
location.