nginx-upload-prgress下载地址:http://wiki.nginx.org/NginxHttpUploadProgressModule
nginx-upload-module下载地址及相关说明:http://www.grid.net.ru/nginx/upload.en.html
接下来安装Nginx
1.安装Nginx所需的pcre库:
# unzip pcre-8.21.zip
# ./configure
# make && make install
2.安装Nginx
# groupadd www
# useradd -g www www
# unzip masterzen-nginx-upload-progress-module-v0.8.2-0-g8b55a34.zip
# unzip nginx_upload_module-2.2.0.zip
# tar xvf nginx-1.0.11.tar.gz
# cd nginx-1.0.11
# ./configure --prefix=/usr/local/webserver/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --add-module=../masterzen-nginx-upload-progress-module-8b55a34/ --add-module=../nginx_upload_module-2.2.0
# make && make install
配置Nginx如下,部分如下
server
{
listen 80;
server_name web.test.com;
index index.html index.htm;
root /data/html/www;
if ($host = 'test.com' )
{
rewrite ^/(.*)$ http://web.test.com/$1 permanent;
}
if (-d $request_filename)
{
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}
# Upload form should be submitted to this location
location /upload {
# 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 /test ;
upload_pass_args on;
upload_limit_rate 128k;
upload_store /data/html/www/source/image/sourceImage;
upload_store_access user:r;
upload_pass_form_field "^.*$";
upload_cleanup 400 404 499 500-505;
}
location /test {
proxy_pass http://localhost:10000/image/upload;
}
# Pass altered request body to a backend
location ~ .*\.php {
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
}
大概解释一下每个参数
upload_pass 指明了需要后续处理的地址
upload_cleanup 如果出现400 404 499 500-505之类的错误,则删除上传的文件
upload_store 上传文件存放地址
upload_store_access 上传文件的访问权限,user:r是指用户可读
upload_limit_rate 上传限速,如果设置为0则表示不限制
upload_set_form_field 设定额外的表单字段。这里有几个可用的变量:
$upload_file_name 文件原始名字
$upload_field_name 表单的name值
$upload_content_type 文件的类型
$upload_tmp_path 文件上传后的地址
upload_aggregate_form_field 额外的变量,在上传成功后生成
$upload_file_md5 文件的MD5校验值
$upload_file_size 文件大小
upload_pass_form_field 从表单原样转到后端的参数,可以正则表达式表示官方的例子是upload_pass_form_field "^submit$|^description$";意思是把submit,description这两个字段也原样通过upload_pass传递到后端处理。如果希望把所有的表单字段都传给后端可以用upload_pass_form_field "^.*$";
相关推荐
也是IMAP/POP3/SMTP代理服务器,是由俄罗斯人lgor Sysoev开发,支持模块加载和卸载,其中upload_module和upload_progress_module就是第三方开发的模块,并没有加入到Nginx的源码中,upload_module是上传文件到服务器...
nginx-upload-progress模块源码,用于nginx配置获取文件上传进度。
nginx-upload-module模块源码,用于nginx配置文件上传功能
我用nginx1.8.0,编译nginx upload模块的时候报有些函数和成员找不到(upload不兼容新版本的nginx),后来在网上找了解决方法,将打好的包上传到这里。亲测可用。
Nginx上传模块该模块基于Nginx上传模块(v 2.2.0) 。 ...由于似乎作者没有维护该模块。 我更改了一些可以与最新的nginx一起安装的代码。 安装./configure --add-module = {module_dir} && make &&进行安装conf ...
nginx-upload-progress-module 是 Nginx 的文件上传时支持进度显示的扩展模块。 标签:nginx
nginx的文件上传模块
nginx-upload-module-master模块,用户nginx 上传文件。
jquery-upload-progress, 上传进度栏使用 apache Nginx 和lighttpd上传进度模块 它可以与apache上传进度模块,Nginx 上传进度模块或者lighttpd一起使用,在这里阅读更多: ...
为OpenResty增加nginx_upload_module模块-附件资源
nginx安装文件上传ngx_upload模块教程.docx
用于Nginx交叉编译源码包,实现RTMP/HTTP推流、nginx反向代理、文件上传等功能。 模块清单: 1、nginx-1.18.0 2、nginx-http-flv-module 3、nginx-rtmp-module 4、nginx-upload-module-master 5、nginx-upload-...
Nginx上传模块 的模块,用于使用多部分/表单数据编码( )处理文件上载以及根据协议进行的可恢复上载。 描述 该模块解析请求正文,该请求正文存储所有要上传到由指令指定的目录中的文件。 然后将文件从正文中剥离,...
nginx的文件上传获取实时进度条模块
前端请求 nginx 服务, nginx 调用 upload 脚本,脚本通过查找配置,找到对应的逻辑存储路径和物理存储机器的 agent 的 ip 和端口,通过 tcp 发包到对应 agent ,部署在对应机器的 agent 接受数据,并写到本地文件。...
Nginx Web 服务器的模块,允许您控制文件上传到您的服务器。 有许多可能的用例,从分布式的大规模上传农场,到在发送整个文件之前对上传进行简单验证。
概述 今天遇到一个问题,在PHP程序中上传图片出现了以下错误:HTTP:413 Request Entity Too Large。 开发环境:CentOS + Nginx + PHP + MySql 解决方案 解决此问题,根据上传数据文件...upload_max_filesize = 2M (上
选用go http模块实现,比nginx、ftp等更方便快捷。 需求整理 上传接口"/v1/file_upload/" 上传接口增加简单BasicAuth鉴权 上传成功返回下载URL json格式返回 参考博客 ...
1. 上传 upload 目录中的文件到服务器 2. 设置目录属性(windows 服务器可忽略这一步) 以下这些目录需要可读写权限 ./upload ./configuration/cache ./html 3. 执行安装脚本 请在浏览器中运行 install 程序...
一个统一授权、认证的后台管理系统,其中包含用户管理、角色权限管理、菜单管理、机构和岗位管理、日志管理等多个模块环境依赖JDK 1.8 以上IDEA 请安装对应IDE的lombok插件Nginx数据库 Mysql 5.1 及以上缓存 Redis ...