Laravel上传大文件提示413 Request Entity Too Large错误

在使用Laravel开发项目时,遇到前台使用AJAX插件上传图片,结果报错(Error: 413 Request Entity Too Large),通过服务器响应信息可以看出是请求头过长。

解决方案是在web服务器进行配置,这里以Nginx服务器为例,设置:client_max_body_size的大小。

官网原文如下:

Syntax: client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, location

Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size.

设置client_max_body_size的大小为 2m 即可。

Copyright © http://blog.webfsd.com 2018 all right reserved,powered by Gitbook该文件修订时间: 2019-05-21 04:55:26

results matching ""

    No results matching ""