413 Request Entity Too Large


Answer :

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

http {       client_max_body_size 20M;          } 

I had the same issue but in docker. when I faced this issue, added client_max_body_size 120M; to my Nginx server configuration,

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

server {     client_max_body_size 120M;     ... 

it resizes max body size to 120 megabytes. pay attention to where you put client_max_body_size, because it effects on its scope. for example if you put client_max_body_size in a location scope, only the location scope will be effected with.

after that, I did add 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 docker PHP image automatically includes all setting files from the path (/usr/local/etc/php/conf.d/) into php.ini file, PHP configuration file will change by these three lines and the issue must disappear


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable