HTTP 413错误解决方法

环境:

Ubuntu 16.04 nginx 1.5.6

通过post上传文件过大时,会出现413错误码;前端打开开发者模式,在输出台的位置会出现:

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

这是由于上传文件过大引起的,排查服务器是否有使用nginx做反向代理;(我这里是)

解决方案:

修改nginx配置文件,配置客户端请求大小和缓存大小

输入命令:

vim /etc/nginx/nginx.conf

在http{}中输入:

        client_max_body_size 8M;(配置请求体缓存区大小, 不配的话) 
        client_body_buffer_size 128k;(设置客户端请求体最大值) 
        fastcgi_intercept_errors on;

重启nginx服务:

service nginx restart

猜你喜欢

转载自blog.csdn.net/qq_33571718/article/details/80242556