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.压缩包等其它类型的文件,同时对于图片可能需要回显,对于其它文件要能够支持下载等.在守望博客系统中对于上 ...
随机推荐
- C# XML序列化帮助类代码
public static class XmlHelper { private static void XmlSerializeInternal(Stream stream, object o, En ...
- TEA加密算法的C/C++实现
TEA(Tiny Encryption Algorithm) 是一种简单高效的加密算法,以加密解密速度快,实现简单著称.算法真的很简单,TEA算法每一次可以操作64-bit(8-byte),采用128 ...
- kabina启动配置
启动 kibana # /usr/local/kibana-4.1.1-linux-x64/bin/kibana zjtest7-redis:/usr/local/kibana-4.5.3-linux ...
- 剑指offer-面试题4.替换空格
题目:请实现一个函数,把字符串中的每个空格都替换成"%20".例如输入"We are happy." 则输出"We%20are%20happy.&qu ...
- 哥德尔,图灵和康托尔 part 1 哥德尔编号
在看计算理论相关的书的时候,偶然看到这个blog,http://skibinsky.com/godel-turing-and-cantor-the-math/,写的很好.我觉得用自动机的方式讲计算理论 ...
- 不重启mysqld更改root密码
Ever found yourself working on a MySQL server where root’s password is unavailable? It has happened ...
- hdu 5441 Travel(并查集)
Problem Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is t ...
- execute immediate的简单用法(oracle)
直接上示例代码: create or replace procedure proc_test( --参数区域 ) is --变量区域 --sql脚本 v_sql ) :=''; --记录学生数量 v_ ...
- crm使用url打开窗口视图
//URL可寻址元素使您能够包含指向Microsoft Dynamics CRM窗口. 视图. 对话框和其它应用程序中的报告. //这样.您就能够轻松扩展其它应用程序.报表或站点,以便用户无需切换应用 ...
- Ruby中,&:(ampersand colon)的用法
前几日看Ruby代码,发现一个奇怪的用法,如下: a=['a', 'b', 'c'].map! &:upcase p a #["A", "B", &qu ...