7th November 2015

nginx: 413 Request Entity Too Large - File Upload Issue

I got above error message in nginx. Stackoverflow post 413 Request Entity Too Large - File Upload Issue had all information to resolve the issue. The solution was written by User Arun.

One has to edit /etc/nginx/nginx.conf and add in http{...}

client_max_body_size 15900M ;

and /etc/php/php.ini

; Maximum allowed size for uploaded files.
; https://php.net/upload-max-filesize
upload_max_filesize = 15900M

; Maximum amount of memory a script may consume (128MB)
; https://php.net/memory-limit
memory_limit = 6900M

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; https://php.net/post-max-size
post_max_size = 25900M

Besides editing /etc/nginx/nginx.conf and /etc/php/php.ini I had to stop nginx and php-fpm:

systemctl stop nginx
systemctl stop php-fpm

so the changes take effect.

After starting the two services then check with phpinfo().

Categories: Linux, web-server
Author: Elmar Klausmeier