Answer the question
In order to leave comments, you need to log in
Why doesn't client_max_body_size work in location?
According to the manual https://nginx.org/ru/docs/http/ngx_http_core_modul...
client_max_body_size can be specified in http, server, location.
But for some reason it works for me only in http and server, version nginx 1.17.4
Why is location ignored? I need to make sure that admins can upload files of 300-400 mb, but users can't. Of course, you can do a check on php, but why force the server if nginx itself can chop off the excess.
Answer the question
In order to leave comments, you need to log in
server {
client_max_body_size 32M;
location /faq/upload {
client_max_body_size 400M;
try_files $uri @admin_upload;
}
location @admin_upload {
rewrite ^ /index.php break;
fastcgi_pass ... ;
include fastcgi_params;
}
location ~ \.php$ {
fastcgi_pass ... ;
include fastcgi_params;
}
And what does it mean that it doesn't work?
In addition to the level of nginx itself, there is also a backend. And its settings. For example, there are two directives in php: upload_max_filesize and post_max_size.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question