我正在使用带上传进度模块的nginx上传模块在我的本地机器上进行一些测试。因为我是本地的,所以上传几乎是即时的,因此很难测试和调试上传进度模块。
我已根据文档添加了指令:upload_limit_rate 8k到我的nginx上传块:http://www.grid.net.ru/nginx/upload.en.html
毕竟,上传一个多兆字节的文件仍然是即时的......似乎 上传速率限制不起作用..
这是我的配置块:
可在此处找到FULL CONFIG: http://pastie.org/4681229
location / upload {
# Pass altered request body to this location
upload_pass @unicorn;
# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
upload_store /Users/kirkquesnelle/Sites/porelo/tmp/uploads 1;
# Allow uploaded files to be read only by user
upload_store_access user:r;
# Set specified fields in request body
upload_set_form_field $upload_field_name.name "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";
# Inform backend about hash and size of a file
upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
upload_pass_form_field "^X-Progress-ID|^authenticity_token|^submit$|^description$";
upload_cleanup 400 404 499 500-505;
# Specifies upload rate limit in bytes per second. Zero means rate is unlimited.
upload_limit_rate 8k;
track_uploads proxied 30s;
}
我的配置有什么问题吗?为什么这不起作用?
谢谢
答案 0 :(得分:1)
尝试在upload_limit_rate
指令前设置upload_pass
。作为配置块中的第一行。