I'm setting up a Magento store with nginx, and the store is working great. However, now I would like to set a higher client_max_body_size value (let's say 100m), but only for the admin section.
I've already searched online, but I can't figure out how to get this to work. I'm probably misunderstanding the location blocks in this scenario, so maybe you can help me further.
I have the following server block:
server { listen 80; server_name {domain}; root {root}; location / { index index.html index.php; try_files $uri $uri/ @handler; expires max; } ## These locations should be protected location ^~ /app/ { deny all; } location ^~ /includes/ { deny all; } location ^~ /lib/ { deny all; } location ^~ /media/downloadable/ { deny all; } location ^~ /pkginfo/ { deny all; } location ^~ /report/config.xml { deny all; } location ^~ /var/ { deny all; } location /. { return 404; } location /api { rewrite ^/api/rest /api.php?type=rest last; } location @handler { rewrite / /index.php; } location ~ .php/ { rewrite ^(.*.php)/ $1 last; } location ~ .php$ { if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass hhvm; proxy_read_timeout 300s; proxy_connect_timeout 300s; fastcgi_read_timeout 300s; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_CODE $mage_code; fastcgi_param MAGE_RUN_TYPE $mage_type; include fastcgi_params; } } Now let's say the admin is on http://domain.com/index.php/admin_section/. So I must apply a higher client_max_body_size within a location block location /index.php/admin_section/ { ... }. But when I do so, that rule is being ignored by the last location ~ .php$ { ... } block.
I know I can adjust some config rules within a if ($request_uri ~ /admin_section/) { ... } statement, but nginx won't accept the client_max_body_size directive within an if statement.
Then I tried to add a location block before and within the ~ .php$ location block and before any other location block. I also tried to copy the content of ~ .php$ block to the /index.php/admin_section/ block and put it before and after the ~ .php$ block, but nothing seems to work.
How do I get this to work?

