3

我已经使 Nginx Upload 与 Python (Tornado) 一起正常工作。我将上传文件的路径保存在数据库中。

但是,我想知道为什么上传模块必须拆分我的上传并将它们放入 10 个不同的文件夹中/var/www/.../uploads/0,1,2,3,4,5...9?下面的评论说文件被散列了,模块是什么以及为什么这样做?

  # Store files to this directory
  # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
  upload_store /var/www/...uploads 1;
4

1 回答 1

2
# filesystem location where we store uploads
#
# The second argument is the level of "hashing" that nginx will perform
# on the filenames before storing them to the filesystem. I can't find
# any documentation online, so as an example, say we were using this
# configuration:
#
#   upload_store /tmp/uploads 2 1;
#
# A file named '43829042' would be written to this path:
#
#   /tmp/uploads/42/0/43829042
#
# I hope that's clear enough. The argument is required and must be
# greater than 0. You can see the implementation here:
#
#  http://lxr.evanmiller.org/http/source/core/ngx_file.c#L118

资料来源:http ://bclennox.com/extremely-large-file-uploads-with-nginx-passenger-rails-and-jquery

于 2013-04-03T13:03:42.083 回答