计算机学习

您现在的位置是:首页 > nginx > 正文

nginx

上传文件报错“413 Request Entity Too Large”原因与解决方法

hhb2022-05-15nginx144
  1. 设置 

client_max_body_size     50m; 

以上代码我是加在nginx.conf中http{ }里面的    当然你也可以选择在server{ }中设置:client_max_body_size 20m;     

还可以选择在location{ }中设置:client_max_body_size 20m;   

2.三者有区别如下:

2.1 设置到http{}内,控制全局nginx所有请求报文大小;

2.2 设置到server{}内,控制该server的所有请求报文大小;

2.3 设置到location{}内,控制满足该路由规则的请求报文大小;

我在nginx.conf里设置,重启nginx发现没效果.

是由于我在配置https的ssl-blog.conf文件下的location里面也配置了client_max_body_size 20m

,需要注释掉。

image.png



发表评论

评论列表

  • 访客(2024-07-08 06:14:17)回复取消回复

    楼主加油,看好你哦!http://nlwrg4.xzzbfc.com/