Cache purging doesn't work for me


#1

Hi folks,

I tried this amazing plugin and the cache itself is working fine, but it wouldn't purge the cache when I edit any page. The Faux Purge Cache doesn't work either and also the mysite.com/purge/fufu option.

My nginx vhost configuration is the following:

fastcgi_cache_path /var/cache/nginx/pixels levels=1:2 keys_zone=WORDPRESS:200m inactive=2400h;  
    fastcgi_cache_key "$scheme$request_method$host$request_uri";  
    fastcgi_cache_use_stale error timeout invalid_header http_500;  

server {  
listen 80;  
listen   443 ssl;  
ssl_certificate /etc/nginx/cert/my.crt;  
ssl_certificate_key /etc/nginx/cert/my.key;  
    server_name server.name.com;  
    root /var/www/mysite;  

    gzip on;  
    gzip_buffers 16 8k;  
    gzip_vary on;  
    gzip_types text/plain text/css text/xml application/x-javascript application/xml application/xml+rss text/javascript;  

    if ($request_method = POST) {  
        set $skip_cache 1;  
    }  
    if ($query_string != "") {  
        set $skip_cache 1;  
    }  

    if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.$  
        set $skip_cache 1;  
    }  

    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {  
                set $skip_cache 1;  
        }  

 if (!-e $request_filename)  
 {  
    rewrite ^(.+)$ /index.php?q=$1 last;  
 }  

 error_page 404 /index.php;  

 location / {  
    index  index.php index.html index.htm;  
 }  

 location ~ \.php$ {  

    try_files $uri /index.php;  
    include fastcgi_params;  
    fastcgi_pass unix:/var/run/php5-fpm.sock;  
    fastcgi_cache_bypass $skip_cache;  
    fastcgi_no_cache $skip_cache;  

    fastcgi_cache WORDPRESS;  
    fastcgi_cache_valid 200 2400h;  
    fastcgi_cache_valid any 5m;  
}  

 location ~ /purge(/.*) {  
    fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";  
 }  

 location ~* ^.+\.(js|css|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|$  
    access_log off; log_not_found off; expires max;  
 }  

location = /robots.txt { access_log off; log_not_found off; }  
location ~ /\. { deny  all; access_log off; log_not_found off; }  

if (-f $request_filename) {  
    break;  
}  
}  

Sorry, this is very long I know, but something is wrong there. PHP and nginx run as the same user and when I login as that user I can delete files from the cache directory.

Can you see any problems in my config?

Best regards, Christian


#2

I figured out the problem. It was my old rewrite rule, which I mixed in your configuration for clean urls, but yours is already able to do it.

Thanks, it is working amazingly good. Anyway, I added gzip support and css/js to static file caching. I will also set up a ramdisk later that day.

Best regards


#3