client_max_body_size per $request_uri

skyroski nginx-forum at nginx.us
Sat Jan 28 10:52:38 UTC 2012


Hi, I have found similar topics on discussion with location based
request but because I'm using a PHP software that by default handles
everything through a single PHP file (including processing POST uploads
of files) I would like to be able to use 

if ($request_uri ~* upload$) {
    client_max_body_size 200M;
}

for example, so that all URI with the word upload at the end will
automatically get set a larger client_max_body_size.

But given that the above syntax is currently impossible. How would I be
able to achieve the same result?

The way my nginx conf works is via:

upstream php {
   server unix:/php.sock;
}

if (!-e $request_filename) {
  rewrite ^/(.*)$ /index.php/$1 last;
  break;
}

location ~ \.php$ {
  fastcgi_pass php;
  include fastcgi_params;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221727,221727#msg-221727



More information about the nginx mailing list