NGINX "client_max_body_size" directive does not work inside "location" block

Solution 1:

It works just fine, the problem is you have misunderstood how locations work. Nginx will only ever apply one location block, never more than one. So when you have two locations

location ~ \.php$ and location /admin and the URI is /admin/index.php then your first location applies but the second one doesn't. Even if you were to use a rewrite within a location then nginx would discard directives and reparse them for the new location.

This is also the reason why you always post full configs so that you don't hide what's actually wrong.