HTTP 413 Request Entity Too Large Error

  • Fix Nginx

The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request. If size is greater the given one, then the client gets the error “Request Entity Too Large” (413).
Edit /etc/nginx/nginx.conf and modify client_max_body_size value. Example

# set client body size to 2M #
client_max_body_size 2M;
  • Fix PHP
    Edit php.ini
;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M

;The maximum size of an uploaded file.
upload_max_filesize = 2M

;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 3M


Written on November 12, 2017