1、安装模块
3 |
tar zxvf nginx_upload_module-2.0.12.tar.gz |
进入nginx源码目录
1 |
./configure --with-http_stub_status_module \ --add-module=/data/software/nginx_upload_module-2.0.12 |
2 |
make#新增模块,不用make install |
3 |
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak |
4 |
cp ./objs/nginx /usr/local/nginx/sbin/nginx |
2、修改配置文件,在server中增加一下内容
02 |
upload_pass /info.php;#上传完成后端接受处理文件 |
03 |
upload_store /data/uptmp;#上传文件夹 |
04 |
upload_limit_rate 1024k;# 限制上传速度 |
05 |
upload_set_form_field "${upload_field_name}_name" $upload_file_name;#文件名称 |
06 |
upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;#文件类型 |
07 |
upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;#上传到的路径 |
08 |
upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;#md5 |
09 |
upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;#文件大小 |
10 |
upload_pass_form_field "^submit$|^description$"; |
11 |
#如果希望把所有的表单字段都传给后端可以用upload_pass_form_field "^.*$"; |
3、前端代码
up.html
07 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
08 |
<form name="upload" method="POST" enctype="multipart/form-data" action="/upload"><!--提交到上面的/upload--> |
09 |
<input type="file" name="file"> |
11 |
<input type="submit" name="submit" value="Upload"> |
info.php
2 |
header("Content-Type:text/html; charset=utf-8"); |
上传会返回如下图数据

from:http://foooy.me/nginx/158.html
- 解决nginx上传模块nginx_upload_module传递GET参数
解决nginx上传模块nginx_upload_module传递GET参数的方法总结 最近用户反映我们的系统只能上传50M大小的文件, 希望能够支持上传更大的文件. 很显然PHP无法轻易实现大文件上传 ...
- nginx上传模块nginx_upload_module和nginx_uploadprogress_module模块进度显示,如何传递GET参数等。
ownload:http://www.grid.net.ru/nginx/download/nginx_upload_module-2.2.0.tar.gzconfigure and make : . ...
- nginx上传模块—nginx upload module-
一. nginx upload module原理 官方文档: http://www.grid.net.ru/nginx/upload.en.html Nginx upload module通过ngin ...
- luajit+nginx+上传模块+lua模块编译安装
git clone https://github.com/fdintino/nginx-upload-module.git git clone https://github.com/openresty ...
- Nginx Upload Module 上传模块
传统站点在处理文件上传请求时,普遍使用后端编程语言处理,如:Java.PHP.Python.Ruby等.今天给大家介绍Nginx的一个模块,Upload Module上传模块,此模块的原理是先把用户上 ...
- Nginx的Upload上传模块
前段时间做一个项目,需要上传文件,差不多需要20M左右,普通用php处理会比较麻烦,经常超时,而且大量占用资源.于是搜索了下,决定用nginx的upload上传模块来处理. 你可以在这里:http:/ ...
- UEditor独立图片、文件上传模块
百度的UEditor编辑器的强大之处不用多说,但是有时候我们只想用他的文件.图片上传模块,不想把这个编辑器加载出来,话不多说,直接上实现代码: 引用文件: <script src="~ ...
- nginx上传文件时 nginx 413 Request Entity Too Large 错误
产生原因: 上传文件的大小超出了 Nginx 允许的最大值,默认是1M: 解决方法: 修改Nginx的配置文件(一般是:nginx/nginx.conf),在 http{} 段中增大nginx上传文件 ...
- 基于SpringBoot从零构建博客网站 - 设计可扩展上传模块和开发修改头像密码功能
上传模块在web开发中是很常见的功能也是很重要的功能,在web应用中需要上传的可以是图片.pdf.压缩包等其它类型的文件,同时对于图片可能需要回显,对于其它文件要能够支持下载等.在守望博客系统中对于上 ...
随机推荐
- 连接oracle数据库出现:ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
Java使用 jdbc:oracle:thin:@11.1.0.14:1521:orcl 连接oracle数据库出现: ORA-12505,TNS:listener does not currentl ...
- 网关协议学习:CGI、FastCGI、WSGI、uWSGI
一直对这四者的概念和区别很模糊,现在就特意梳理一下它们的关系与区别. CGI CGI即通用网关接口(Common Gateway Interface),是外部应用程序(CGI程序)与Web服务器之间的 ...
- HtmlNodeType枚举
HtmlNodeType是一个枚举,用于说明一个节点的类型. 源代码如下所示: public enum HtmlNodeType { Document = 0, Element = 1, Commen ...
- JDBC的使用——Statement
JDBC是Java最基本的数据库操作途径,虽然现在有了更高端的Hibernate和JPA,但是其实它们的底层还是用的这些最基本的JDBC.而且,如果开发一个小型的应用程序,使用Hibernate不免有 ...
- 2013第51周二eclipse启动优化
2013第51周二eclipse启动优化 今天注意到了eclipse.ini配置文件中gc.log--在eclipse启动时清空,然后记录了eclipse每次运行过程中的gc分配情况,看到了一篇很好的 ...
- 百度地图JavaScript API V1.5初级开发工具类
/** * 百度地图使用工具类-v1.5 * @author boonya * @date 2013-7-7 * @address Chengdu,Sichuan,China * @email boo ...
- Invert Binary Tree 解答
Quetion Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Solution 1 -- R ...
- Container With Most Water 解答
Question Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate ...
- 正则表达式、find、grep、awk、sed
1.正则表达式 (1)正则表达式一般用来描述文本模式的特殊用法,由普通字符(例如字符a-z)以及特殊字符(称为元字符,如/.*.?等)组成. (2)基本元字符集及其含义 ^ :只 ...
- Unity 改变类模板-为你的类添加一个命名空间
之前在写代码的时候,就很疑惑为什么创建类的时候.没有命名空间呢? 后来自己的类终于和别人写的类名字有冲突.... 如何修改Unity创建类的模板呢? 找到下面这个文件 然后修改 保存文件在Uni ...