在编译 Nginx 时需要确保包含了 upload_progress
模块,可以使用下面的命令:
./configure --add-module=/path/to/nginx_uploadprogress_module
make
make install
如果已经安装了 Nginx,则可以使用以下命令来启用 upload_progress
模块:
cd /path/to/nginx
./configure --add-module=/path/to/nginx_uploadprogress_module
make
make install
然后在 Nginx 的配置文件中添加以下内容:
location /progress {
report_upload_progress on;
upload_progress_json_output;
}
location /upload {
upload_progress uploads;
#需要上传处理的其他指令
}
最后,重新启动 Nginx 服务即可。