Default nginx client_max_body_size
我一直在收到nginx错误:
1 | 413 Request Entity Too Large |
我已经能够将我的nginx.conf文件的server部分中的
可以在
嵌套块中的此伪指令优先于祖先块中的同一伪指令。
摘自ngx_http_core_module文档:
1
2
3 Syntax: client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, locationSets the maximum allowed size of the client request body, specified in
the"Content-Length" request header field. If the size in a request
exceeds the configured value, the 413 (Request Entity Too Large) error
is returned to the client. Please be aware that browsers cannot
correctly display this error. Setting size to 0 disables checking of
client request body size.
别忘了重新加载配置
通过
Pooja Mane的答案对我有用,但是我必须将client_max_body_size变量放在http部分中。
您可以通过以下方式在nginx配置文件中增加主体大小:
sudo nano /etc/nginx/nginx.conf
client_max_body_size 100M;
重新启动nginx以应用更改。
sudo service nginx restart