Welcome! Log In Create A New Profile

Advanced

how can i set diffrent proxy cache time by diffrent uri

February 15, 2016 05:11AM
i tried to use like this

server {

set $cache_time 1d;

if ($request_uri = "/") {
set $cache_time 3d;
}

if ($request_uri ~ "^/other") {
set $cache_time 30d;
}

location / {
try_files $uri @fetch;
}

location @fetch {
proxy_cache_valid 200 301 302 $cache_time;
}
}

then i got error "invalid time value "$cache_time" in /etc/nginx/xxx.conf

how can i fix this?
Subject Author Posted

how can i set diffrent proxy cache time by diffrent uri

vps4 February 15, 2016 05:11AM

Re: how can i set diffrent proxy cache time by diffrent uri

Maxim Dounin February 15, 2016 08:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 46
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready