上传文件 nginx 413错误

nginx : 413 Request Entity Too Large

上传文件过程发生413 Request Entity Too Large错误,翻译为请求实体过大,断定为nginx限制了请求体大小,翻看nginx文档发现default: client_max_body_size 1m

client_max_body_size

syntax:client_max_body_size size

default:client_max_body_size 1m

context:http, server, location

Directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request.

If size is greater the given one, then the client gets the error "Request Entity Too Large" (413).

It is necessary to keep in mind that the browsers do not know how to correctly show this error.

果断打开nginx/conf/nginx.conf,在http模块中增加 client_max_body_size 10m;

别忘记后面的分号

nginx/sbin/nginx -s reload

OK,问题解决;