Advice on max_ranges for specific location block

Maxim Dounin mdounin at
Thu Mar 6 12:19:14 UTC 2014


On Thu, Mar 06, 2014 at 06:21:22AM -0500, sephreph wrote:

> Hi,
> Hopefully this question isn't too basic, I just want to check if I'm missing
> something obvious.
> I'm setting up a basic nginx installation with php-fpm behind it running on
> - that's working fine.  I'm using max_ranges set to 5
> globally in the server block (example below), but I have a specific PHP
> script (/free.php) that I want max_ranges set to 0 for.  I'm not sure how to
> achieve this.
> max_ranges needs to be in a http, server or location block, so would the
> best solution be to copy the "location ~ \.php" block and call it "location
> ~* /free.php" and just add the "max_ranges 0" setting in there?  I was
> hoping that location blocks cascade so I could overwrite that setting and
> then the request would fall into the .php block but I don't think that's
> actually the case?

Generally I would recommend adding a "location = /free.php" with 
settings specific to a particular script.

On the other hand, in this case there is no real reason to do 
anything as nginx won't try to add ranges support for fastcgi 
output.  It's up to your fastcgi script decide how to to handle 
range requests.

Maxim Dounin

More information about the nginx mailing list