RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Nginx(3)---Nginx上传文件优化-创新互联
1.安装nginx-upload-module模块

下载nginx-upload-module

成都创新互联公司是一家业务范围包括IDC托管业务,雅安服务器托管、主机租用、主机托管,四川、重庆、广东电信服务器租用,雅安电信机房,成都网通服务器托管,成都服务器租用,业务范围遍及中国大陆、港澳台以及欧美等多个国家及地区的互联网数据服务公司。
wget https://github.com/fdintino/nginx-upload-module/archive/2.3.0.tar.gz
//解压
tar -xvf 2.3.0.tar.gz

重新编译nginx

//编译nginx
cd /stukk/nginx-1.13.7

./configure --prefix=/usr/local/nginx3 --with-http_stub_status_module --add-module=../nginx-upload-module-2.3.0 --with-http_ssl_module --with-pcre=/stukk/pcre-8.45

make && make install

cd /usr/local/nginx3/conf
vim nginx.conf

//在location那增加这个路径配置
 location /upload {
       upload _pass /res_upload;
       upload_store /usr/local/nginx2/html;
 }

 location /res_upload {
       default_type text/html;
       return 200 "success";
 }


//新建个html页面来玩一玩
cd ..
cd html
vim file.html


在file.html中写入

Test Upload  Select files to upload

运行,打开页面

2.设置上传文件大小的限制

上传文件大小默认为1mB

打开nginx.conf,在server中修改就ok
client_max_body_size 10m

//再 重新运行
./nginx -s reload

基本就OK了

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧


当前文章:Nginx(3)---Nginx上传文件优化-创新互联
转载注明:http://scyingshan.cn/article/gieio.html