====== PHP Upload Configuration (PHP 8.3 FPM) ======
===== 1. Edit php.ini =====
File location:
/etc/php/8.3/fpm/php.ini
Update the following values:
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 256M
max_execution_time = 300
Notes:
* upload_max_filesize = maximum size allowed for a single uploaded file
* post_max_size = maximum total size of POST request (must be greater than or equal to upload_max_filesize)
* memory_limit = maximum memory a PHP script can consume
* max_execution_time = maximum execution time in seconds
Restart PHP-FPM:
sudo systemctl restart php8.3-fpm
-----
===== 2. Nginx Configuration =====
If large uploads return "413 Request Entity Too Large", update your Nginx server block:
server {
server_name api-warehouse.quizz.vn;
root /var/www/warehouse/warehouse-be/public;
client_max_body_size 100M;
}
Reload Nginx:
sudo nginx -t
sudo systemctl reload nginx
-----
===== 3. Verification =====
Check current PHP limits:
php -i | grep upload_max_filesize
Or create a temporary file: