Increase File Upload Size Limit In PHP-Nginx

If Nginx aborts your connections when you upload large files, you will get “[error] 25556#0: *52 client intended to send too large body:” error. Means you will need to increase PHP file-upload size limit. Follow the below steps to do this.

Change in php.ini

For example change max file upload size 50MB.


vim /etc/php5/fpm/php.ini


upload_max_filesize = 50M
post_max_size = 50M

Notes: Technically, post_max_size should always be larger than upload_max_filesize but for large numbers like 50M you can safely make them equal.

Change in Nginx config

Add following line to http{..} block in nginx config:

http {
        client_max_body_size 50m;

Note: For very large files, you may need to change value of client_body_timeout parameter. Default is 60s.

Reload PHP-FPM & Nginx

# service php5-fpm reload
# service nginx reload

Changes in WordPress-Multisite

If you are running WordPress Multisite setup, then you may need to make one more change at the WordPress end.

Go to: Network Admin Dashboard >> Settings. Look for Upload Settings

Also change value for Max upload file size.



Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment