Category Archives: LEMP on CentOS

Solution for 413 request entity too large on PHP & Nginx Server

on /etc/nginx/nginx.conf add the following line to server or location or http context to increase the size limit.

client_max_body_size 200M;

 

http {
.....
      client_max_body_size 200M;
.....       
}

 

On /etc/php.ini search the line and set the following directives

;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 = 200M

;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 = 30M

 

Restart or reload your php and nginx server.

service nginx restart
service php-fpm restart