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
Posted at Nginx Forum: