mediawiki fastcgi_cache not working

Anoop Alias anoopalias01 at gmail.com
Wed Apr 16 14:01:59 UTC 2014


Hi,

I have setup nginx with ngx_cache_purge to work with mediawiki

nginx.conf
###
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m
inactive=60m;
        fastcgi_cache_key "$scheme$host$request_uri";
###

vhost.conf
###
set $no_cache "";
        if ($request_method !~ ^(GET|HEAD)$) {
                 set $no_cache "1";
        }




        if ($request_method ~ "PURGE")
                        {
                                        rewrite (.*) /PURGE$1 last;
                        }

        location / {
                if (!-e $request_filename) {
                        rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2
last;
                }

                if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") {
                        expires max;
                        break;
                }
        }

        location /PURGE/ {
        allow              127.0.0.1;
        fastcgi_cache_purge MYAPP;
}

location ~ \.php$ {

                fastcgi_cache MYAPP;
                fastcgi_cache_methods GET HEAD;
                fastcgi_cache_valid 200 5m;
                add_header X-Cache "$upstream_cache_status";
                fastcgi_cache_bypass $no_cache $http_cookie;
                fastcgi_no_cache $no_cache $http_cookie;
                fastcgi_ignore_headers Expires Cache-Control;
}

####


The caching is working fine as .But whenever I edit a page I can see the
following in the access log

127.0.0.1 - - [16/Apr/2014:09:37:59 -0400]  "PURGE /Knowledge_Base
HTTP/1.1" 405 166 "-" "MediaWiki/1.21.3 SquidPurgeClient" - "-" 0


Regardless the page is never purged and I see the cached page unless nginx
is restarted .

What am I doing wrong here . Why is the PURGE request generating a 405
response?

Thank you,

-- 
*Anoop P Alias*
GNUSYS <http://gnusys.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140416/248e150d/attachment-0001.html>


More information about the nginx mailing list