2

我正在使用带有上传进度模块的 nginx 上传模块在我的本地机器上进行一些测试。因为我是本地人,所以上传几乎是即时的,因此很难测试和调试上传进度模块。

我已根据文档将指令:upload_limit_rate 8k 添加到我的 nginx 上传块:http: //www.grid.net.ru/nginx/upload.en.html

毕竟,上传几兆字节的文件仍然是即时的……看来上传速率限制不起作用……

这是我的配置块:

完整配置可以在这里找到:http: //pastie.org/4681229


位置/上传{

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

}


我的配置有什么问题吗?为什么这行不通?

谢谢

4

1 回答 1

1

Try to set the upload_limit_rate before your upload_pass directive. As the first line in your config block.

于 2012-09-06T19:33:13.440 回答