Magento与Nginx:不同的configuration规则pipe理部分

我正在用nginxbuild立一个Magento商店,而且这家商店工作得很好。 但是,现在我想设置一个更高的client_max_body_size值(比方说100米),但仅限于pipe理部分。

我已经在网上search,但我不知道如何得到这个工作。 我可能误解了这种情况下的位置块,所以也许你可以进一步帮助我。

我有以下服务器块:

 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; } } 

现在让我们说,pipe理员是在http://domain.com/index.php/admin_section/ 。 所以我必须在位置块location /index.php/admin_section/ { ... }内应用更高的client_max_body_size 。 但是当我这样做的时候,这个规则被最后一个location ~ .php$ { ... }块忽略了。

我知道我可以在if ($request_uri ~ /admin_section/) { ... }语句中调整一些configuration规则,但nginx不会接受if语句中的client_max_body_size指令。

然后,我尝试在~ .php$位置块之前和之内添加位置块,并在任何其他位置块之前添加位置块。 我也尝试将/index.php/admin_section/ ~ .php$块的内容复制到/index.php/admin_section/块,并将其放在/index.php/admin_section/ ~ .php$块之前和之后,但似乎没有任何效果。

我如何得到这个工作?

以下块可能工作。 它复制PHP位置块(这是您的pipe理员URI通常的最终目的地)。

 location ^~ /index.php/admin_section/ { client_max_body_size 100m; expires off; fastcgi_pass hhvm; proxy_read_timeout 300s; proxy_connect_timeout 300s; fastcgi_read_timeout 300s; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/index.php; fastcgi_param MAGE_RUN_CODE $mage_code; fastcgi_param MAGE_RUN_TYPE $mage_type; } 

我无法testing,但希望没有任何副作用打破Magento。