默认nginx client_max_body_size [英] Default nginx client_max_body_size
问题描述
我一直在收到nginx错误:
I have been getting the nginx error:
413 Request Entity Too Large
我已经可以将我的nginx.conf文件的server部分中的client_max_body_size
更新为20M,这已解决了该问题.但是,默认的nginx client_max_body_size
是什么?
I have been able to update my client_max_body_size
in the server section of my nginx.conf file to 20M and this has fixed the issue. However, what is the default nginx client_max_body_size
?
推荐答案
client_max_body_size
指令的默认值为 1 MiB .
可以在http
,server
和location
上下文中进行设置-如
It can be set in http
, server
and location
context — as in the most cases,
this directive in a nested block takes precedence over the same directive in the ancestors blocks.
Syntax: client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, location
设置客户端请求正文的最大允许大小,在 "Content-Length"请求标头字段.如果在请求中的大小 超过配置的值,则出现413(请求实体太大)错误 返回给客户端.请注意,浏览器无法 正确显示此错误.将size设置为0将禁用对 客户请求的正文大小.
Sets 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.
别忘了重新加载配置
通过nginx -s reload
或service nginx reload
命令(以sudo
开头)(如果有).
Don't forget to reload configuration
by nginx -s reload
or service nginx reload
commands prepending with sudo
(if any).
这篇关于默认nginx client_max_body_size的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!