文章内容

2024/6/13 17:31:06,作 者: 黄兵

Failed to load resource: the server responded with a status of 413 ()

最近在更换了新的服务器,原来程序上传文件会出现如下错误:

Failed to load resource: the server responded with a status of 413 ()

出现问题的原因:

413 Request Entity Too Large 当客户端发出的请求太大而无法被 Web 服务器处理时,就会发生错误。

如果您的 Web 服务器设置了特定的 HTTP 请求大小限制,客户端可能会遇到响应。

413 Request Entity Too Large 一个可能导致此错误的示例请求是,如果客户端试图将大型文件上传到服务器(例如大型媒体文件)。

解决方案:

如果我们使用的是 nginx,可以修改 /etc/nginx/nginx.conf 文件:

sudo vi /etc/nginx/nginx.conf

在 http, server 或者是 location 增加一行:

client_max_body_size 100M;

之后测试 nginx 是否正确:

sudo nginx -t

之后重新加载 nginx 配置:

sudo nginx -s reload



参考资料:

1、413 Request Entity Too Large - File Upload Issue

2、Error : Failed to load resource: the server responded with a status of 413 (Request Entity Too Large) [duplicate]


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - Failed to load resource: the server responded with a status of 413 ()

分享到:

发表评论

评论列表