Increase file upload size limit in PHP-Nginx

If Nginx aborts your connection when uploading large files, you will see something like below in Nginx’s error logs:

[error] 25556#0: *52 client intended to send too large body:

This means, you need to increase PHP file-upload size limit.

Following steps given below will help you troubleshoot this!

Changes in php.ini

To change max file upload size to 128MB

Edit…

nano /etc/php/7.4/fpm/php.ini

change…

upload_max_filesize = 128M

Reload PHP-FPM & Nginx

sudo service php7.4-fpm reload
sudo service nginx reload

Get in touch 👋

Feel free to email me about anything. Want some advice? Give some feedback?

You can also reach me around the web: LinkedIn, GitHub, X (formerly Twitter)