Hello,
ngx_cache_purge is a module which adds ability to purge content from
FastCGI
and proxy caches. This is rewrite of well-tested cache_purge patch
(kindly
funded by yo.se), so hopefully this short introduction is enough
Hi,
like I said before, you need to put ālocation ~ /purge(/.)" before
"location ~ ..(jpg|gif)$ā.
In your current configuration āhttp://www.test.com/purge/1.gifā is
served by
ālocation ~ .*.(jpg|gif)$ā. This is because both regexp locations match
your query and in such case nginx picks the first one from the top.
I mean everything is ok before I limited .jpg and .gif to be cached.
So I didnāt write all configurations here.
Then, I give the full version before and current for you to help me.
Itās in cache indeed, because I can see the picture in my browser
(with F5, and Ctrl+F5) even after I delete 1.gif from that server.
########################################################
server {
server_name www.test.com;
listen 80;
access_log logs/proxy.log;
location ~ .*\.(jpg|gif)$ { # I want only jpg/gif to be cached
proxy_cache cache1;
proxy_cache_valid 200 304 15m;
proxy_cache_key $host$uri$is_args$args;
proxy_pass http://backend;
}
location / # All others not cached
{
proxy_pass http://backend;
}
location ~ /purge(/.*)
{
proxy_cache_purge cache1 $host$1$is_args$args;
}
}
Thank you, I thought you can repeat this problem easily.
hi Piotr,
i used nginx 0.75 before, and compile ngx_cache_purge with nginx 0.85.2,
after ./configure --add-module=ā¦/ngx_cache_purge-1.2 ā¦(my own
parameters) and make, i didnāt run a make install and just cp objs/nginx
covering the old one. itās general method when i upgrade the nginx. i
found there is a file named ngx_cache_purge_module.o in the directory
objs/addon/ngx_cache_purge-1.2, but i donāt know where should i cp it
to. could you please tell me how to install your mod with a running
nginx?
thanks a lot
regards
solo
hi piotr,
sure, i have restarted nginx for many times. but it donāt work well now
stillā¦
need i copy ngx_cache_purge_module.o to main dir of nginx? or is there
any way to check whether your mod has been compiled with nginx well?
regards
solo
Hi,
both of your outputs: ānginx -Vā and ānginx -tā suggest that nginx is
compiled with āfastcgi_cache_purgeā support.
Are you sure that youāre running the same nginx binary as your init.d
script? What happens when you execute nginx binary yourself (without
using
init.d or other scripts)?
hi piotr,
i have no idea with this case, and have to reinstall whole nginx, it
works well now, thanks a lot for your help.
i donāt know why, but it works nowā¦
regards
solo
hi piotr,
could you please help me one more question? is it useful to cache a php
script in fastcgi_cache? in other words, need i disable fastcgi cache
for all php script? thanks a lot
regards
solo