• Nginx上传模块nginx-upload-module安装和配置


    Nginx上传模块nginx-upload-module安装和配置

    安装编译工具及库文件

    yum -y install make wget git zlib zlib-devel gcc-c++ libtool  openssl openssl-devel
    
    
    • 1
    • 2

    插件包准备

    wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
    
    tar zxvf pcre-8.35.tar.gz
    
    git clone -b 2.2 https://github.com/vkholodkov/nginx-upload-module
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    安装Nginx

    wget http://nginx.org/download/nginx-1.10.2.tar.gz
    
    tar -zxvf nginx-1.10.2.tar.gz
    
    cd nginx-1.10.2
    
    ./configure --prefix=/data/apps/nginx-upload \
        --pid-path=/data/logs/nginx-upload/nginx.pid \
        --lock-path=/data/apps/nginx-upload/nginx.lock \
        --error-log-path=/data/logs/nginx-upload/error.log \
        --http-log-path=/data/logs/nginx-upload/access.log \
        --http-client-body-temp-path=/data/temps/nginx-upload/client_body_temp \
        --http-proxy-temp-path=/data/temps/nginx-upload/proxy_temp \
        --http-fastcgi-temp-path=/data/temps/nginx-upload/fastcgi_temp \
        --http-uwsgi-temp-path=/data/temps/nginx-upload/uwsgi_temp \
        --http-scgi-temp-path=/data/temps/nginx-upload/scgi_temp \
        --with-http_stub_status_module \
        --with-http_ssl_module \
        --with-pcre=/data/software/pcre-8.35 \
        --add-module=/data/software/nginx-upload-module
    
    
    make
    make install
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    配置信息

    user  root;
    error_log  /data/logs/nginx-upload/error.log;
    access_log  /data/logs/nginx-upload/access.log;
    pid        /data/logs/nginx-upload/nginx.pid;
    
        server {
            client_max_body_size 100m;
            listen       80;
            # Enables resumable uploads.
            upload_resumable on;
    
            location ~/media/file/\S+/upload{
                    upload_pass @fileUpload;
                    upload_state_store /data/temps/upload_temp/upload_state;
                    upload_store /data/temps/upload_temp/upload_tempfile;
                    upload_set_form_field "name" "$upload_file_name";
                    upload_set_form_field "content_type" "$upload_content_type";
                    upload_set_form_field "path" "$upload_tmp_path";
                    upload_aggregate_form_field "md5" "$upload_file_md5";
                    upload_aggregate_form_field "size" "$upload_file_size";
                    upload_pass_form_field "^submit$|^description$";
                    upload_cleanup 400 404 499 500-505;
                    upload_pass_args on;
            }
            
            location @fileUpload {
                    proxy_pass http://127.0.0.1:8080;
            }
        }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
  • 相关阅读:
    Maven常见命令
    Vue--Router--动态路由的用法
    QT笔记——QMetaEnum类
    计算机毕业设计(附源码)python智慧门诊综合管理系统
    分布式账本技术(Distributed Ledger Technology)和区块链(Blockchain)的简要介绍
    [Java Framework] [MQ] SpringBoot 集成RabbitMQ
    leetCode 121. 买卖股票的最佳时机 贪心算法
    数字化时代的利器:数仓助力企业破局突围
    京东数据产品:8月大家电市场增长类目市场数据分析
    MySQL通过bin log日志恢复数据|手撕MySQL|对线面试官
  • 原文地址:https://blog.csdn.net/yinjl123456/article/details/126877727