nginx、Apache、IIS服务器解决 413 Request Entity Too Large问题方法汇总
一、nginx服务器
nginx出现这个问题的原因是请求实体太长了。一般出现种情况是Post请求时Body内容Post的数据太大了,
如上传大文件过大、POST数据比较多。
处理方法
在nginx.conf增加client_max_body_size的相关设置,这个值默认是1m,可以增加到8m以增加提高文件大小限制;当然可以设置的更大点。
#在http,server或者location段修改下面的配置: #setclientbodysizeto8M# client_max_body_size8M;
二、Apache服务器
修改下Apache配置文件中的LimitRequestBody配置,如果是虚拟主机,请联系空间商帮助修改。
具体步骤:
在apache环境中上传较大软件的时候,有时候会出现413错误,出现这个错误的原因,是因为apache的配置不当造成的,找到apache的配置文件目录也就是conf目录,和这个目录平行的一个目录叫conf.d打开这个conf.d,里面有一个php.conf
目录内容如下:
# #PHPisanHTML-embeddedscriptinglanguagewhichattemptstomakeit #easyfordeveloperstowritedynamicallygeneratedwebpages. #
LoadModulephp4_modulemodules/libphp4.so
# #CausethePHPinterpreterhandlefileswitha.phpextension. #
SetOutputFilterPHP SetInputFilterPHP LimitRequestBody6550000
# #Addindex.phptothelistoffilesthatwillbeservedasdirectory #indexes. # DirectoryIndexindex.php