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

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

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 *