nginx修改上传文件大小限制的方法
新装了一台服务器,用nginx做代理。突然发现上传超过1M大的客户端文件无法正常上传,于是修改了下nginx的配置。
cd/export/servers/nginx/conf/nginx.conf,在这个配置文件里面的server段里面的
location/{
roothtml;
indexindex.htmlindex.htm;
client_max_body_size1000m;
}
加上了client_max_body_size 字段,怎么重启都不行。后来在总配置文件里面发现了分配置文件:
sendfileon;
#tcp_nopushon;
#keepalive_timeout0;
keepalive_timeout65;
#gzipon;
includedomains/*;#########################分配置文件路径在此
#includedomains/chat.local;
#includedomains/chat.erp.com;
#includedomains/support.chat.com;
#includedouains/chat.com;
server{
listen80;
server_namelocalhost;includedomains/*命令指定了分配置文件的路径。找到了分配置文件后,在分配置文件里面进行修改。分配置文件配置如下:
server
{
listen80;
server_namechat.erp.360buy.com;
#access_log/export/servers/nginx/logs/chat.erp.360buy.com;
location/{
proxy_passhttp://tomcat;
client_max_body_size1000m;
}
}
用/export/servers/nginx/sbin/nginx-sreload重启下,上传文件的大小受限的问题就解决了。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。