Welcome! Log In Create A New Profile

Advanced

Different cache_valid per location

nfn
June 15, 2012 06:41AM
Hi,

I'm trying to find the correct way to have different cache times per location.
The problem I have is that all locations are redirected using try_files to the same file and then to fastcgi.

I was thinking about something like this, but it doesn't work:

fastcgi_cache_path /var/cache/nginx/one levels=1:2 keys_zone=one:500m;

server {

location /a {
fastcgi_cache_valid 200 15m;
try_files $uri $uri/ /index.php;
}

location /b {
fastcgi_cache_valid 200 60m;
try_files $uri $uri/ /index.php;
}

## PHP
location ~ \.php$ {
...
fastcgi_cache one;
fastcgi_cache_use_stale error timeout invalid_header http_500;
...
}
}

How can I archive this?

Thanks

NN
Subject Author Posted

Different cache_valid per location

nfn June 15, 2012 06:41AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready