上传文件报413Request EntityToo Large错误解决办法

简介: 产生这种原因是因为服务器限制了上传大小,有nginx服务器的解决办法、apache服务器修改。

QQ图片20220425231023.jpg

产生这种原因是因为服务器限制了上传大小


1、nginx服务器的解决办法


修改nginx.conf的值就可以解决了


将以下代码粘贴到nginx.conf内


client_max_body_size 20M


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


也可以选择在server{ }中设置:client_max_body_size 20m;


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


三者有区别


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


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


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


2、apache服务器修改


在apache环境中上传较大软件的时候,有时候会出现413错误,出现这个错误的原因,是因为apache的配置不当造成的,找到apache的配置文件目录也就是conf目录,和这个目录平行的一个目录叫conf.d打开这个conf.d,里面有一个php.conf


目录内容如下:


#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php4_module modules/libphp4.so
#
# Cause the PHP interpreter handle files with a .php extension.
#
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 6550000
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php


错误就发生在这个LimitRequestBody配置上,将这个的值改大到超过你的软件大小就可以了


如果没有这个配置文件请将


SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 6550000


写到apache的配置文件里面即可。



目录
相关文章
|
1月前
|
Java Spring
DWR上传文件提示File uploads not supported
确保你的DWR配置和代码都正确地支持文件上传,以解决"DWR上传文件提示File uploads not supported" 错误。
16 0
|
1月前
|
开发工具 git
Git上传出现:The requested URL returned error: 403解决办法
Git上传出现:The requested URL returned error: 403解决办法
98 0
|
1月前
|
应用服务中间件 nginx
上传文件失败413 Request Entity Too Large,nginx配置文件大小的限制
上传文件失败413 Request Entity Too Large,nginx配置文件大小的限制
|
1月前
|
中间件 应用服务中间件 Apache
Higress有对max_request_bytes做限制吗?我有个应用上传文件报413 request entity too large错误
Higress有对max_request_bytes做限制吗?我有个应用上传文件报413 request entity too large错误
51 0
|
7月前
|
应用服务中间件 nginx
413 request entity too large 解决办法
413 request entity too large 解决办法
372 0
|
开发框架 .NET Windows
IIS程序后台上传文件报错 413 Request Entity Too Large
IIS程序后台上传文件报错 413 Request Entity Too Large
|
应用服务中间件 nginx
Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】
Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】
Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】
成功解决404 Not Found Not Found The requested URL was not found on the server. If yo
成功解决404 Not Found Not Found The requested URL was not found on the server. If yo
|
Web App开发 应用服务中间件 PHP
解决上传文件时 nginx 413 Request Entity Too Large 错误
一个使用Tomcat 发布的站点,使用Nginx做了代理,在上传文件时发生以下错误: 413 Request Entity Too Large 413 Request Entity Too Large nginx/1.10.3 在使用文件上传组件如:webuploader 上传时只会提示文件上传失败,具体的错误需要打开浏览器的开发者工具才能看到。
3604 0
|
对象存储
上传文件到OSS报错:[Server]Unable to execute HTTP request: Position is not equal to file length
上传文件到OSS报错:[Server]Unable to execute HTTP request: Position is not equal to file length
1074 0