由于php处理上传会出现超时,并且显示上传进度官方php不支持nginx+php,所以决定让nginx自己处理上传,我本地环境是mac上已经安装过nginx1.8.0,安装方式为brew,所以需要重新编译nginx添加upload模块。

  nginx下载地址:http://nginx.org/en/download.html

    nginx-upload-module下载地址:https://github.com/vkholodkov/nginx-upload-module/tree/2.2

解压nginx

  tar xvzf nginx-1.8.0.tar.gz

  nginx-upload-module解压目录为:/usr/local/nginx-upload-module-2.2

  由于upload模块没有随着nginx的更新出新版本,所以有些地方需要修改,下载补丁文件,地址:http://paste.davromaniak.eu/index.php?show=110

  下载文件名为davromaniak.txt,放入/usr/local/nginx-upload-module-2.2目录,执行补丁

cp darvromaniak.txt /usr/local/nginx-upload-module-2.2
patch ngx_http_upload_module.c davromaniak.txt

执行完毕后,开始编译nginx

  nginx -V查看已经安装的nginx的版本和编译参数(这是我的nginx参数)

nginx version: nginx/1.8.0
built by clang 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
built with OpenSSL 1.0.2a 19 Mar 2015
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/1.8.0 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx/1.8.0/bin/nginx --with-cc-opt='-I/usr/local/Cellar/pcre/8.36/include -I/usr/local/Cellar/openssl/1.0.2a-1/include' --with-ld-opt='-L/usr/local/Cellar/pcre/8.36/lib -L/usr/local/Cellar/openssl/1.0.2a-1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_gzip_static_module

cd nginx-1.8.0

加上--add-module=/usr/local/nginx-upload-module-2.2(nginx-upload-module解压目录)参数重新编译:

  

./configure --prefix=/usr/local/Cellar/nginx/1.8.0 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx/1.8.0/bin/nginx --with-cc-opt='-I/usr/local/Cellar/pcre/8.36/include -I/usr/local/Cellar/openssl/1.0.2a-1/include' --with-ld-opt='-L/usr/local/Cellar/pcre/8.36/lib -L/usr/local/Cellar/openssl/1.0.2a-1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_gzip_static_module --add-module=/usr/local/nginx-upload-module-2.2

   编译完成后千万不要make && make install(不然会覆盖安装nginx)

  编译成功后备份旧nginx

  cp /usr/local/Cellar/nginx/1.8.0/bin/nginx  /usr/local/Cellar/nginx/1.8.0/bin/nginx.bak

把新的nginx程序覆盖旧的
     cp /usr/local/nginx-1.8.0/objs/nginx /usr/local/Cellar/nginx/1.8.0/bin/nginx

到此,nginx的upload模块安装完毕

  

nginx重新编译安装upload模块的更多相关文章

  1. 原已经安装好的nginx,现在需要添加一个未被编译安装的模块--echo-nginx-module-0.56

    为了测试一个NGINX变量,将NGINX加了一个编译模板echo-nginx-module-0.56. 参照如下文件 1,先看以前NGINX有哪些东东. sbin/nginx -Vnginx vers ...

  2. Nginx编译安装第三方模块http_substitutions_filter_module2222

    Nginx编译安装第三方模块http_substitutions_filter_module Rming -- 阅读 安装 Http 编译 module filter nginx 模块 >> ...

  3. Nginx编译安装第三方模块http_substitutions_filter_module

    Nginx编译安装第三方模块http_substitutions_filter_module 分类:服务器技术  作者:rming  时间:-- . >>ngx_http_substitu ...

  4. 【01】Nginx:编译安装/动态添加模块

    写在前面的话 说起 Nginx,别说运维,就是很多开发人员也很熟悉,毕竟如今已经 2019 年了,Apache 更多的要么成为了历史,要么成为了历史残留. 我们在提及 Nginx 的时候,一直在强调他 ...

  5. 已经编译安装的nginx/tenginx编译增加新模块

    只适用于自行编译安装的nginx配置 业务变更带来的Nginx增加模块需求 由于业务从php转为go开发,需要用到Http2的协议.这种协议在Nginx上需要http_v2_module这个模块的支持 ...

  6. 初识Nginx及编译安装Nginx

    初识Nginx及编译安装Nginx 环境说明: 系统版本    CentOS 6.9 x86_64 软件版本    nginx-1.12.2 1.什么是Nginx? 如果你听说或使用过Apache软件 ...

  7. Nginx 的编译安装和URL地址重写

    本文转自:http://www.178linux.com/14119#rd?sukey=ecafc0a7cc4a741b573a095a3eb78af6b4c9116b74d0bbc9844d8fc5 ...

  8. vim编译安装+lua模块

    vim编译安装+lua模块 使用背景:代码自动补全插件,需要安装lua模块 安装准备,首先下载安装vim所依赖的其它安装包,ncurses,lua,readline,vim 源码下载,编译安装 ncu ...

  9. linux 编译安装PHP模块

    本文移到:http://www.phpgay.com/Article/detail/classid/6/id/54.html  linux 编译安装PHP模块 1.首先你要有你服务器上安装的PHP的版 ...

随机推荐

  1. Github Actions教程:运行python代码并Push到远端仓库

    我自己做了一个网站,这个网站会使用一个python脚本来生成. 具体生成的方法是python脚本会读取目录下的csv文件,将每一行数据解析成固定格式,然后生成html文件,最后需要将修改后的文件自动p ...

  2. Python 爬虫十六式 - 第一式:HTTP协议

    HTTP:伟大而又无闻的协议 学习一时爽,一直学习一直爽!   Hello,大家好啊,我是Connor,一个从无到有的技术小白.有的人一说什么是HTTP协议就犯愁,写东西的时候也没想过什么是HTTP协 ...

  3. Redis实战(十七)Redis各个版本新特性

    序言 Redis1.0 Redis2.0 Redis3.0 Redis4.0 Redis5.0 资料

  4. [NOIP2017]注意点

    1.数据大却没开long long 导致的gg.2.文件读入时stdin打成stdout...3.桶维护数值,有负值要平移,且数值最好稍大(否则可能RE).4.很智障地打错变量.5.DP或其他涉及到转 ...

  5. Prim算法和Kruskal算法的正确性证明

    今天学习了Prim算法和Kruskal算法,因为书中只给出了算法的实现,而没有给出关于算法正确性的证明,所以尝试着给出了自己的证明.刚才看了一下<算法>一书中的相关章节,使用了切分定理来证 ...

  6. cmake尝试检测GCC版本报错

    本人尝试编译指定commit版本的MRPT库,报错如下, CMake Error at cmakemodules/script_detect_gcc.cmake: (LIST): list GET g ...

  7. A - 地震预测

    A - 地震预测 怀特先生是一名研究地震的科学家,最近他发现如果知道某一段时间内的地壳震动能量采样的最小波动值之和,可以有效地预测大地震的发生. 假设已知一段时间的n次地壳震动能量的采样值为a1,a2 ...

  8. arguments详解——函数内命名参数之映射

    首先,arguments对象是所有(非箭头)函数中都可用的局部变量.你可以使用arguments对象在函数中引用函数的参数.此对象包含传递给函数的每个参数,第一个参数在索引0处. arguments对 ...

  9. springBoot+springSecurity 数据库动态管理用户、角色、权限(二)

    序: 本文使用springboot+mybatis+SpringSecurity 实现数据库动态的管理用户.角色.权限管理 本文细分角色和权限,并将用户.角色.权限和资源均采用数据库存储,并且自定义滤 ...

  10. rtmpdump禁用openssl

    rtmpdump禁用openssl 主要是编译方便 很多地方根本不需要用openssl 先找到librtmp/rtmp_sys.h 然后加入宏#define NO_CRYPTO在#ifdef _WIN ...