client_max_body_size per $request_uri
Edho Arief
edho at myconan.net
Sat Jan 28 13:40:39 UTC 2012
On Sat, Jan 28, 2012 at 8:16 PM, skyroski <nginx-forum at nginx.us> wrote:
> For the record, I used a combination of a similar issue in the mailing
> list and a combination of what @Valentin suggested.
>
> In the end, this is what works for me:
>
> if ($request_uri ~* upload$) {
> rewrite ^/(.*)$ /upload/$1 last;
> }
>
> location ~ /upload/(.*)$ {
> internal;
> client_max_body_size 200M;
> fastcgi_param PHP_VALUE ....;
> fastcgi_pass php;
> fastcgi_param SCRIPT_FILENAME $document_root/index.php;
> include fastcgi_params;
> fastcgi_param QUERY_STRING /$1;
> fastcgi_param DOCUMENT_URI /index.php;
> fastcgi_param SCRIPT_FILENAME /index.php;
> }
>
> All the rest I didn't have to change with the exception of adding an
> extra clause to the location \.php$ block to restore PHP_VALUE to
> default settings.
>
> I understand around-abouts why IF is evil but if it's supposed to be
> safe for rewrites and return then I'd rather take advantage of that
> instead of using location / with try files so that I can deal with query
> strings attachments easier and it ends up shorter to implement.
>
too bad this doesn't work :/
map $request_uri $uplimit {
~upload$ 200m;
default 1m;
}
client_max_body_size $uplimit;
--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the nginx
mailing list