如何避免请求实体太大 413 错误 [英] How to avoid Request Entity Too Large 413 error

查看:35
本文介绍了如何避免请求实体太大 413 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何避免这个 413 错误?

How to avoid this 413 error ?

请求实体太大

请求的资源/serverpath/reports.php不允许使用POST请求请求数据,或者请求中提供的数据量超过容量限制.

The requested resource /serverpath/reports.php does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.

位于 demo3.website_name 端口 80 的 Apache 服务器

Apache Server at demo3.website_name Port 80

那么,谁能帮忙设置php.ini以及如何设置htaccess以允许覆盖状态

So, could any one please help to set php.ini and how to set htaccess to allow overwrite status

推荐答案

如何在 NGINX 中修复?client_max_body_size

要解决此问题,您需要增加 client_max_body_size 指令的值.该指令定义了 Nginx 将在 HTTP 请求中接受的最大数据量.默认情况下,此值设置为 1 兆字节,这意味着如果您尝试上传大于 1 兆字节的文件,您将收到错误 413:请求实体页面太大.您可以在三个级别插入此指令:

To fix this, you need to increase the value of the client_max_body_size directive. This directive defines the maximum amount of data Nginx will accept in an HTTP request. By default this value is set to 1 megabyte, meaning if you attempt to upload a file larger than 1 megabyte you'll be getting an Error 413: Request entity too large page. You can insert this directive at three levels:

  • 在 http 块中:这将为您的配置中的所有服务器和位置设置指令值

  • In the http block: this will set the directive value for all server and locations in your configurationn

在服务器块中:这将为一个特定服务器的所有位置设置指令值

In the server block: this will set the directive value for all locations of one particular server

在位置块中:这将为特定服务器中的一个特定位置设置指令值

In the location block: this will set the directive value for one specific location in a particular server

在本例中,我将把它插入到我的 http 块中并将其设置为 500 兆字节:

In this example I'm going to insert it in my http block and set it to 500 megabytes:

http {

    client_max_body_size 500M; # allows file uploads up to 500 megabytes
    [...]
}

来源:http://cnedelcu.blogspot.com.ar/2013/09/nginx-error-413-request-entity-too-large.html

这篇关于如何避免请求实体太大 413 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆