Nginx + php-fpm increase upload_max_filesize and other php values per vhost
Recent version of PHP support the PHP_VALUE command for fcgi processes. This means that php ini directives can be configured for each Nginx virtual host individually.
The trick is that multiple values need to be set in one "fastcgi_param PHP_VALUE" directive with a newline character as separator otherwise only the last one will be used by the php process.
Configure php upload_max_filesize from nginx fastcgi parameters
The
upload_max_filesize php ini configuration sets the maximum size of an uploaded file.
Example of increasing PHP's
upload_max_filesize ini setting via Nginx web server:
Code:
location ~ \.php$ {
fastcgi_param PHP_VALUE "upload_max_filesize = 50M \n post_max_size=51M";
}
Below example is INCORRECT:
Code:
location ~ \.php$ {
fastcgi_param PHP_VALUE "upload_max_filesize = 50M";
fastcgi_param PHP_VALUE "post_max_size=51M";
}