Nginx上传模块nginx-upload-module安装和配置
安装编译工具及库文件
yum -y install make wget git zlib zlib-devel gcc-c++ libtool openssl openssl-devel
插件包准备
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
安装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
配置信息
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;
}
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。