Welcome! Log In Create A New Profile

Advanced

Advice on max_ranges for specific location block

March 06, 2014 06:21AM
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 127.0.0.1:9000 - 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?


A basic example of what I'm currently using is:
server {
listen 80;
server_name localhost;
max_ranges 5;

location / {
root /var/www/example.com;
index index.php;
}

location ~ \.php {
set $script $uri;
set $path_info "";

if ($uri ~ "^(.+\.php)(/.*)") {
set $script $1;
set $path_info $2;
}

client_body_temp_path /tmp 1;
client_max_body_size 2048m;
fastcgi_pass 127.0.0.1:9000;
fastcgi_read_timeout 300;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/example.com$script;

include /etc/nginx/fastcgi_params;
}
}
SubjectAuthorPosted

Advice on max_ranges for specific location block

sephrephMarch 06, 2014 06:21AM

Re: Advice on max_ranges for specific location block

Maxim DouninMarch 06, 2014 07:20AM

Re: Advice on max_ranges for specific location block

sephrephMarch 06, 2014 04:23PM

Re: Advice on max_ranges for specific location block

sephrephMarch 06, 2014 05:23PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready