# 反向代理 413 Request Entity Too Large 问题

**URL:** <https://www.isharkfly.com/t/413-request-entity-too-large/13963>\
**Category:** DevOps\
**Tags:** nginx, apache\
**Created:** [May 13, 2022, 6:18pm UTC](https://www.isharkfly.com/t/413-request-entity-too-large/13963 "2022-05-13T18:18:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [May 13, 2022, 6:18pm UTC](https://www.isharkfly.com/t/413-request-entity-too-large/13963/1 "2022-05-13T18:18:45Z")

</div>

如果在服务器上使用了反向代理。

你可能会收到下面的错误信息： `413 Request Entity Too Large` errors`。

## 问题和解决

问题的原因就是反向代理服务器针对 HTTP 访问的时候有限制，

### Nginx

在 Nginx 的配置文件中，添加下面的内容 `client_max_body_size 100M;`

![nginx-413-error-01](https://www.isharkfly.com/images/transparent.png)

上面的配置信息显示了具体的配置位置。

在默认情况下 Nginx 配置的 client\_max\_body\_size 大小为 1M。

很多时候是肯定不够用的。

### Apache

Apache 在 http.conf 配置文件中有一个 LimitRequestBody 参数。

你可以将这个参数配置为：`LimitRequestBody 104857600`。

虽然你成功配置了上面的参数，但是有时候上面的参数在 Apache 中可能没有办法解决你的问题。

这是因为有时候和后台代理的程序也有关系。

## 总结

根据最近想买的一些调整，使用 Nginx 作为反向代理，会比 Apache 更加轻量，配置更加容易。
