nginx limit file upload size code example

Example 1: how to increase nginx maximum file upload size

sudo nano /etc/nginx/nginx.conf
# edit/add the following line 
client_max_body_size 8M; # put the size that is enough
sudo nano /etc/php/php.ini
# edit the following
upload_max_filesize=8M # also put what is enough

Example 2: nginx max file upload size

#just need to set these params in php-from file: /etc/php/7.2/fpm/php.ini
upload_max_filesize = 100M
post_max_size = 100M

#may need to increase this param in /etc/nginx/nginx.conf if its exists as is limited
client_max_body_size 100m;

Tags:

Misc Example