1、安装模块

1 cd /data/software
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中增加一下内容

01 location /upload {
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 "^.*$";
12 }

3、前端代码

up.html

01 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
02 <html xmlns="http://www.w3.org/1999/xhtml">
03 <head>
04 <title>无标题文档</title>
05 </head>
06 <body>
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">
10  
11 <input type="submit" name="submit" value="Upload">
12 </form>
13 </body>
14 </html>

info.php

1 <?php
2     header("Content-Type:text/html; charset=utf-8");
3     print_r($_POST);

上传会返回如下图数据

from:http://foooy.me/nginx/158.html

nginx上传模块nginx_upload_module使用的更多相关文章

  1. 解决nginx上传模块nginx_upload_module传递GET参数

    解决nginx上传模块nginx_upload_module传递GET参数的方法总结 最近用户反映我们的系统只能上传50M大小的文件, 希望能够支持上传更大的文件. 很显然PHP无法轻易实现大文件上传 ...

  2. 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 : . ...

  3. nginx上传模块—nginx upload module-

    一. nginx upload module原理 官方文档: http://www.grid.net.ru/nginx/upload.en.html Nginx upload module通过ngin ...

  4. luajit+nginx+上传模块+lua模块编译安装

    git clone https://github.com/fdintino/nginx-upload-module.git git clone https://github.com/openresty ...

  5. Nginx Upload Module 上传模块

    传统站点在处理文件上传请求时,普遍使用后端编程语言处理,如:Java.PHP.Python.Ruby等.今天给大家介绍Nginx的一个模块,Upload Module上传模块,此模块的原理是先把用户上 ...

  6. Nginx的Upload上传模块

    前段时间做一个项目,需要上传文件,差不多需要20M左右,普通用php处理会比较麻烦,经常超时,而且大量占用资源.于是搜索了下,决定用nginx的upload上传模块来处理. 你可以在这里:http:/ ...

  7. UEditor独立图片、文件上传模块

    百度的UEditor编辑器的强大之处不用多说,但是有时候我们只想用他的文件.图片上传模块,不想把这个编辑器加载出来,话不多说,直接上实现代码: 引用文件: <script src="~ ...

  8. nginx上传文件时 nginx 413 Request Entity Too Large 错误

    产生原因: 上传文件的大小超出了 Nginx 允许的最大值,默认是1M: 解决方法: 修改Nginx的配置文件(一般是:nginx/nginx.conf),在 http{} 段中增大nginx上传文件 ...

  9. 基于SpringBoot从零构建博客网站 - 设计可扩展上传模块和开发修改头像密码功能

    上传模块在web开发中是很常见的功能也是很重要的功能,在web应用中需要上传的可以是图片.pdf.压缩包等其它类型的文件,同时对于图片可能需要回显,对于其它文件要能够支持下载等.在守望博客系统中对于上 ...

随机推荐

  1. Java中操作时间比较好用的类

    项目中经常用到日期的操作,包括日期的格式化.下面是几个比较常用的工具类. import java.text.SimpleDateFormat; import java.util.Date; impor ...

  2. Dividing (hdu 1059 多重背包)

    Dividing Sample Input 1 0 1 2 0 0 价值为1,2,3,4,5,6的物品数目分别为 1 0 1 2 0 0,求能否将这些物品按价值分为两堆,转化为多重背包.1 0 0 0 ...

  3. 生产环境中CentOS7部署NET Core应用程序

    NET Core应用程序部署至生产环境中(CentOS7) 阅读目录 环境说明 准备你的ASP.NET Core应用程序 安装CentOS7 安装.NET Core SDK for CentOS7. ...

  4. joseph-约瑟夫环问题

    约瑟夫环运作如下: 1.一群人围在一起坐成环状(如:N) 2.从某个编号开始报数(如:K) 3.数到某个数(如:M)的时候,此人出列,下一个人重新报数 4.一直循环,直到所有人出列,约瑟夫环结束 关于 ...

  5. WPF实现毛玻璃效果

    1和2需要Microsoft.WindowsAPICodePack.Shell.dll 和引用using System.Windows.Interop,并只能在有DwmApi.dll 版本的Windo ...

  6. AlarmReceiver 与IntentService的使用

    1:GetSmsService.java public class GetSmsService extends IntentService{ private AlarmManager alarmMan ...

  7. DataTable Select 使用

    DataView dv = new DataView(table); dv.RowFilter = " Type='10' and Visible='true'"; dv.Sort ...

  8. C# ReferenceEquals(), static Equals(), instance Equals(), 和运算行符==之间的关系

    C#充许你同时创建值类型和引用类型.两个引用类型的变量在引用同一个对象时,它们是相等的,就像引用到对象的ID一样.两个值类型的变量在它们的类型和内容都是相同时,它们应该是相等的.这就是为什么相等测试要 ...

  9. [置顶] ruby复制对象的方法(dup 和 clone)

    Ruby内置的方法Object#clone和Object#dup可以用来copy一个对象,两者区别是dup只复制对象的内容,而clone还复制与对象相关联的内容,如singleton method [ ...

  10. codecomb 2098【stone】

    题目描述 Description n个石堆围成一圈,提供两种操作: 1.每次将[L,R]堆的石子数量+k,其中,1<=L,R<=n,k>=0. 2.询问有最多石子的那一堆有多少石子. ...