Maxim Dounin
November 14, 2010 11:46AM
Hello!

On Sun, Nov 14, 2010 at 12:10:59AM -0500, rajivv wrote:

> I have a issue my nginx cofig is working ok just i want cache to clear
> only once in 15 days.
> But it is clearing everyday and new images showing on homepage ( we use
> random images hence on each refresh its new)
> however with nginx it needs to show same page and images etc picked from
> cache.
> It works ok for 24 hours then again refreshes all content...as if cache
> is clear.

I guess by "random images" you mean random <img src=""> in your
html code, right?

[...]

> http {
> proxy_cache_path /var/lib/nginx/tmp/cache1 levels=1:2
> keys_zone=proxy_cache1:16m max_size=20g inactive=1d;
> proxy_cache_path /var/lib/nginx/tmp/cache2 levels=1:2
> keys_zone=proxy_cache2:16m max_size=40g inactive=30d;
> proxy_temp_path /var/lib/nginx/tmp/proxy;

[...]

> location / {

[...]

> proxy_cache_key
> "$server_name$scheme$proxy_host$uri$is_args$args$cookie_sid";
> proxy_cache proxy_cache1;

Note that your cache key for html contains $cookie_sid. It looks
like session cookie, and probably per-user and likely to expire
somewhere earlier than after 15 days.

Also note that it uses proxy_cache1 which has 1d inactivity
timeout, i.e. if no requests for a given key (with $cookie_sid)
seen by nginx within 1d cache entry will be removed.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx Cache Valid till - Help

rajivv November 14, 2010 12:10AM

Re: Nginx Cache Valid till - Help

t3hslr November 14, 2010 08:18AM

Re: Nginx Cache Valid till - Help

Maxim Dounin November 14, 2010 11:46AM

Re: Nginx Cache Valid till - Help

rajivv November 14, 2010 10:29PM

Re: Nginx Cache Valid till - Help

rajivv November 14, 2010 10:09PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 103
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