# FRiCKLE Labs & yo.se pres. ngx\_cache\_purge

**URL:** <https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369>\
**Category:** NGINX\
**Created:** [January 10, 2010, 11:36pm UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369 "2010-01-10T23:36:19Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [October 14, 2010, 2:10pm UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/21 "2010-10-14T14:10:50Z")

</div>

Hi,

> 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

This depends on your scripts, it’s up to you to decide whatever their  
results are cacheable or not.

Best regards,  
Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>

---

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [October 14, 2010, 5:53am UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/22 "2010-10-14T05:53:27Z")

</div>

Caching php opcode reduces processing time for non fastcgi\_cached Pages

Sent from my iPod

---

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [May 3, 2011, 6:17pm UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/23 "2011-05-03T18:17:33Z")

</div>

Version 1.3 is now available at:  
[http://labs.frickle.com/nginx\_ngx\_cache\_purge/](http://labs.frickle.com/nginx_ngx_cache_purge/)

GitHub repository is available at:

> **[GitHub - FRiCKLE/ngx\_cache\_purge: nginx module which adds ability to purge...](https://github.com/FRiCKLE/ngx_cache_purge/)**
>
> nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches. - GitHub - FRiCKLE/ngx\_cache\_purge: nginx module which adds ability to purge content from FastCGI, proxy...

Changes:  
2011-05-03 VERSION 1.3  
\* Fix compatibility with nginx-1.0.1.  
Reported by Sergey A. Osokin and Markus Linnala.

2010-08-29  
\* Fix compatibility with nginx-0.8.0 and versions older than  
nginx-0.7.60.

Best regards,  
Piotr S. \< removed\_email\_address@domain.invalid \>

---

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [October 6, 2011, 4:12pm UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/24 "2011-10-06T16:12:17Z")

</div>

I need some help on “FASTCGI(PHP) CACHE PURGE”.

I successfully configured my nginx to support purge fastcgi cache with  
Ctrl+F5,while I found that I can not purge the cache by request a uri  
like below:

[http://myserver.com/purge/test.php](http://myserver.com/purge/test.php)  
OR  
[http://myserver.com/purge/myserver.com/test.php](http://myserver.com/purge/myserver.com/test.php)

It always returns a 404 error ☹

HOW CAN I DO IT? Please help me~

Here is the key part of my nginx.conf:

* * *

http {  
include mime.types;  
default\_type application/octet-stream;

…

fastcgi\_cache\_path /tmp/fastcgi\_cache levels=1:2 keys\_zone=TEST:10m  
inactive=5m;  
fastcgi\_connect\_timeout 300;  
fastcgi\_send\_timeout 300;  
fastcgi\_read\_timeout 300;  
fastcgi\_buffer\_size 16k;  
fastcgi\_buffers 16 16k;  
fastcgi\_busy\_buffers\_size 16k;  
fastcgi\_temp\_file\_write\_size 16k;  
fastcgi\_cache TEST;  
fastcgi\_cache\_valid 200 302 1h;  
fastcgi\_cache\_valid 301 1d;  
fastcgi\_cache\_valid any 1m;  
fastcgi\_cache\_min\_uses 1;  
fastcgi\_cache\_use\_stale error timeout invalid\_header http\_500;  
fastcgi\_cache\_key $host$uri$is\_args$args;

```
 ...

```

server {  
listen 80;  
server\_name [myserver.com](http://myserver.com);  
root /home/wwwroot;  
index index.html index.htm index.php;

```
if ($request_method = 'PURGE') {
  rewrite ^(.*)$ /purge$1 last;
}

if ($http_cache_control ~ "no-cache") {
  set $http_cache_control 'max-age=604800';
  rewrite ^(.*)$ /purge$1 last;
}

location ~ /purge(/.*) {
  #allow 127.0.0.1;
  #deny all;
                fastcgi_cache_purge TEST $host$1$is_args$args;
}

location ~ .*\.(php|php5)?$ {
  fastcgi_pass unix:/tmp/php-cgi.sock;
  fastcgi_index index.php;
  fastcgi_split_path_info ^(.+\.php)(.*)$;
  include fcgi.conf;
}

                            ...

log_format access '$remote_addr - $remote_user [$time_local]

```

“$request” ’  
'$status $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent”  
$http\_x\_forwarded\_for’;  
access\_log /home/wwwlogs/access.log access;  
}

}

---

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [October 7, 2011, 6:22am UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/25 "2011-10-07T06:22:13Z")

</div>

Hi,  
assuming that you didn’t change order of locations during copy & paste  
(which _is_ important) then accessing  
“[http://myserver.com/purge/test.php](http://myserver.com/purge/test.php)”  
should purge content which is normally available under  
“[http://myserver.com/test.php](http://myserver.com/test.php)”.

If that’s not the case, then please try debugging it  
([A debugging log](http://nginx.org/en/docs/debugging_log.html)) with ngx\_cache\_purge-1.4  
(just  
released) and look for cache-related entries.

Best regards,  
Piotr S. \< removed\_email\_address@domain.invalid \>

---

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [October 6, 2011, 4:39pm UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/26 "2011-10-06T16:39:32Z")

</div>

This is an interesting feature, would be awsome if this got included in  
the  
core. Can it be made to work based of DELETE (method) requests I wonder?

---

<div class="post-metadata">

**Author:** ![piotrs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@piotrs](https://www.ruby-forum.com/u/piotrs)\
**Post date:** [October 7, 2011, 7:29am UTC](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369/27 "2011-10-07T07:29:19Z")

</div>

Wow~ All things go right after I installed the ngx\_cache\_purge-1.4 !  
Thanks very much!

Posted at Nginx Forum:

> **[Re: FRiCKLE Labs & yo.se pres. ngx\_cache\_purge](https://forum.nginx.org/read.php?2,39564,216354#msg-216354)**
>
> 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 ;) You can download it at...

[Previous page](https://www.ruby-forum.com/t/frickle-labs-yo-se-pres-ngx-cache-purge/181369.md?page=1)
