Upload Progress
Matt M
h.dudeness at gmail.com
Thu Dec 13 14:26:34 UTC 2012
Hi! Thanks for the response.
On Wed, Dec 12, 2012 at 8:56 PM, Sokolov Evgeniy <ewgraf at gmail.com> wrote:
> Hi!
>
> If you compile your nginx with debug - enable debug logging, restart nginx
> and you will see messages from upload module, it is very helpful.
>
> Also read this note
> http://wiki.nginx.org/HttpUploadProgressModule#track_uploads - "The POST
> must have a query parameter called X-Progress-ID"... If the POST has no such
> information, the upload will not be tracked....
I have double checked and I can see the post variable X-Progress-ID
coming with the upload but the status just stays at starting. My
nginx.conf looks like this:
worker_processes 1;
events {
worker_connections 1024;
}
http {
#error_log /usr/local/nginx/logs/error.log debug;
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
upstream modperl {
ip_hash;
server 127.0.0.1:8080;
}
client_body_timeout 10;
client_header_timeout 10;
client_max_body_size 3M;
keepalive_timeout 10;
send_timeout 10;
limit_conn_zone $binary_remote_addr zone=limit_per_ip:16m;
# reserve 1MB under the name 'proxied' to track uploads
upload_progress proxied 1m;
upload_progress_json_output;
# HTTP Server
server {
listen 80;
server_name _;
root /var/www/$host/;
limit_conn limit_per_ip 5;
proxy_buffering off;
## Only allow GET and HEAD request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
# Serve static files directly
location ~*
^(?!\/(internal_documents)).+\.(jpg|jpeg|gif|css|js|ico|html|swf|png|pdf|xls|xlsx|doc|docx)$
{
access_log off;
expires 30d;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location / {
# needed to forward user's IP address to rails
proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_read_timeout 600;
# If the file exists as a static file serve it directly without
# running all the other rewite tests on it
if (-f $request_filename) {
break;
}
proxy_pass http://modperl;
# track uploads in the 'proxied' zone
# remember connections for 30s after they finished
track_uploads proxied 30s;
}
location ^~ /progress {
# report uploads tracked in the 'proxied' zone
report_uploads proxied;
}
}
# HTTPS server - Without SSL Certificate
server {
listen 442;
server_name _;
limit_conn limit_per_ip 5;
proxy_buffering off;
## Only allow GET and HEAD request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
server_name_in_redirect off;
ssl off;
root /var/www/$host/;
# serve static files directly
location ~*
^(?!\/(internal_documents)).+\.(jpg|jpeg|gif|css|js|ico|html|swf|png|pdf|xls|xlsx|doc|docx)$
{
access_log off;
expires 30d;
break;
}
location / {
# needed to forward user's IP address to rails
proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_read_timeout 600;
# If the file exists as a static file serve it directly without
# running all the other rewite tests on it
if (-f $request_filename) {
break;
}
proxy_pass http://modperl;
# track uploads in the 'proxied' zone
# remember connections for 30s after they finished
#track_uploads proxied 30s;
}
location ^~ /progress {
# report uploads tracked in the 'proxied' zone
report_uploads proxied;
}
}
}
More information about the nginx
mailing list