How to Increase file upload size limit in php-Nginx

Increase or set php file upload limit with php fpm and Nginx; Through this tutorial, we will learn how to increase or set php file upload limit with php fpm in Nginx.

How to Increase file upload size limit in php-Nginx

Just follow the following steps to increase or set PHP file upload limit with PHP FPM and Nginx:

  • Step 1 – Edit php.ini file
  • Step 2 – Edit Nginx conf file
  • Step 3 – Restart Nginx Server

Step 1 – Edit php.ini file

First of all, open terminal or command prompt and execute the following command on command line to open and edit php.ini file:

nano /etc/php5/fpm/php.ini

Once the above command has been executed, Then the php.ini file will open on the terminal. So update it by searching the line given below:

upload_max_filesize = 150M
post_max_size = 150M

Step 2 – Edit Nginx conf file

Execute the following command on the command line to open and edit nginx conf file:

nano /etc/nginx/nginx.conf

Once the above command has been executed, Then the ngnix conf file will open on the terminal. So update it by searching the line given below:

http{
....
.....
....
client_max_body_size 150m;
client_body_timeout 120;
......

Step 3 – Restart Nginx Server

Finally execute the following command to restart Nginx and PHP-FPM:

service nginx restart
service php5-fpm restart

Conclusion

Through this tutorial, we have learned how to increase or set php file upload limit with php fpm in Nginx.

Recommended Linux Nginx Tutorials

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button