413 Request entity too large

I use nginX / 1.6 and laravel, when I sent data to the server, I get this error. 413 Request Entity Too Large. I have tried many solutions as below.

1- set client_max_body_size 100m; in server and location and http in nginx.conf. 2- set upload_max_filesize = 100m in php.ini 3- set post_max_size = 100m in php.ini 

After restarting php5-fpm and nginx the problem is still not resolved.

+11
php nginx laravel
source share
2 answers

Add 'client_max_body_size xxM in the http section of /etc/nginx/nginx.conf, where xx is the size (in megabytes) that you want to allow.

 http { client_max_body_size 20M; } 
+29
source share

I had the same problem, but in docker. when I ran into this problem, added client_max_body_size 120M; into the configuration of my Nginx server,

The default nginx configuration file path is /etc/nginx/conf.d/default.conf

 server { client_max_body_size 120M; ... 

It changes the maximum body size to 120 megabytes.

after that I added these three lines to my PHP docker file

 RUN echo "max_file_uploads=100" >> /usr/local/etc/php/conf.d/docker-php-ext-max_file_uploads.ini RUN echo "post_max_size=120M" >> /usr/local/etc/php/conf.d/docker-php-ext-post_max_size.ini RUN echo "upload_max_filesize=120M" >> /usr/local/etc/php/conf.d/docker-php-ext-upload_max_filesize.ini 

since the docker PHP image automatically includes all the configuration files from the path ( /usr/local/etc/php/conf.d/ ) in the php.ini file, the PHP configuration file will change to these three lines and the problem should disappear

0
source share

All Articles