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