To Increase file upload size limit in php-Nginx:
use 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 , php service
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/php8.1/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