nginx设置上传文件大小

用nginx做代理。上传超过1M大的客户端文件无法正常上传,nginx直接报错,上传文件太大(413 Request Entity Too Large)于是修改了下nginx的配置,就可以了。 
server {

listen 80;

server_name localhost;

client_max_body_size 10M;

location /web

{

alias D:/web;

index main.html;

}

location /web/service {

proxy_pass http://192.168.1.188:8080/service;

}

location /web/service/upload {

proxy_pass http://192.168.1.188/upload;

}

}

client_max_body_size 10M 必须要放在server下的server_name下,而不是放在localhost /web的大括号里

猜你喜欢

转载自blog.csdn.net/a12345678n/article/details/81118856