How to set NGINX max post size?
Configuration file containing this setting is usually located
/etc/nginx/nginx.conf
, however check your particular
system for details. To change maximum post size, we need to
adjust client_max_body_size
value, which
should be in http
block.
This parameter can be specified with suffixes like M
for megabytes or G
gigabytes.
Example setting of client_max_body_size
:
This directive can be added to nginx.conf
:
http { # Other Settings... client_max_body_size 800M; # Other Settings... }
Adding upload directive to separate conf file
This directive can also be added in conf.d
folder,
so that system updates will not conflict with modified
nginx.conf
. In such case, we can save file as
/etc/nginx/conf.d/uploads.conf
and it will be
automatically included in server configuration. Name is not
really important here, it just need to end with
.conf
. When using separate file, the wrapping http
part must be omitted, as it will be included in http block, the
file should only contain upload size directive:
client_max_body_size 800M;
Check also how to set upload size in PHP