ahu
October 06, 2011 10:11AM
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
OR
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;
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;
}

}
----------------------------------------------------------
Subject Author Posted

FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora January 10, 2010 05:40PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora June 07, 2010 11:24PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

piggy June 16, 2010 09:28AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

piggy June 16, 2010 09:38AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora June 16, 2010 11:34AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

piggy June 16, 2010 09:21PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora June 16, 2010 09:42PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

piggy June 16, 2010 09:59PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora August 11, 2010 06:04PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora May 03, 2011 12:18PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 12, 2010 05:44AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora October 12, 2010 09:02AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 12, 2010 09:29AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora October 12, 2010 10:14AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 12, 2010 10:46AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 12, 2010 12:13PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora October 12, 2010 12:10PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora October 12, 2010 09:28PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 13, 2010 06:02AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 13, 2010 06:50AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

digginchina October 13, 2010 07:06AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Splitice October 13, 2010 11:56PM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora October 14, 2010 08:14AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

ahu October 06, 2011 10:11AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

ahu October 07, 2011 01:28AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

splitice October 06, 2011 10:40AM

Re: FRiCKLE Labs & yo.se pres. ngx_cache_purge

Piotr Sikora October 07, 2011 12:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 187
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready