How to Increase file upload size limit in php-Nginx

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

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

One reply to How to Increase file upload size limit in php-Nginx

  1. Thank you for sharing this tutorial on how to increase file upload size limit in PHP-Nginx. It was very helpful for me to learn how to make these changes. I followed the steps carefully and was able to successfully increase the file upload size limit. The article was well-written and easy to understand, even for someone like me who is not very experienced with Nginx. I appreciate your efforts in creating this tutorial and sharing your knowledge with us. Keep up the good work!

Leave a Reply

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