• nginx重新编译安装upload模块


      由于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模块安装完毕

      

         

         

  • 相关阅读:
    struts2配置文件详解
    实体类和数据库映射--配置文件
    Hibernate常用配置文件详解
    本地计算机上的OracleOraDb11g_home1TNSListener服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。——Oracle监听器服务无法启动!
    关于远程访问Oracle数据库的设置(共享数据库)
    Log4J日志配置详解
    Java compiler level does not match the version of the installed Java project facet.问题
    Genymotion出现Unable to load VirtualBox engine问题--100%解决
    eclipse注解——作者,创建时间,版本
    web工程下的html中引用其他目录下的文件的path
  • 原文地址:https://www.cnblogs.com/dest/p/4597113.html
Copyright © 2020-2023  润新知