Caching issues

I have no idea how I managed to do this but I ended up in a caching loop. I went to /wp-login.php or /wp-admin/ tried logging in but was always redirected to the login page with a "reauth=1″ appended to the login URL.

I manually deleted the folder containing my fastcgi_cache and was able to proceed.

nginx.conf contains:

        #move next 3 lines to /etc/nginx/nginx.conf if you want to use fastcgi_cache across many sites  
        fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=WORDPRESS:500m inactive=60m;  
        fastcgi_cache_key "$scheme$request_method$host$request_uri";  
        fastcgi_cache_use_stale error timeout invalid_header http_500;  
        fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

Would you mind having a look at my vhost file: http://pastebin.com/20nxEcij

I’ve left it complete to make sure you get the full picture, if you want, I can cut out everything except the caching stuff for easier readability?

It looks like a WordPress problem. I googled and found many results, including yours - http://wordpress.org/support/topic/login-problems-with-reauth1?replies=6 :wink:

Anyway remove following lines…

        #Skip cache for WooCommerce query string  
        if ( $arg_add-to-cart != "" ) { set $skip_cache 1; }  
   
        #Skip cache when WooCommerce cart is not empty  
        if ( $cookie_woocommerce_items_in_cart != "0" ) { set $skip_cache 1; }

They are unnecessary. See if removing them makes any difference.

Sorry for the late reply Rahul but there is something weird happening here - I used to get emails when someone replied to one of my threads here but didn’t get one for this thread :frowning:

I’ve removed those two lines (they were in a template so had been applied to all sites since I thought those rules were safe?)

The problem seems solved for now but I have a new one: how do I test if my fastcgi_cache is working properly? I thought deleting the history and cookies of a browser then browsing the site without being logged in and then comparing the time stamp in the source code would do, but it seems this site: http://foodandchatter.co.za/ is never being cached? No idea why - do you have an easier way to test the cache? I also tried this: http://web-sniffer.net/ and tested my URL but the time stamp is always a new one :frowning:

You answered my question with this article: http://rtcamp.com/wordpress-nginx/tutorials/nginx/upstream-cache-status-in-response-header/

:slight_smile:

I need to follow-up on this thread: I noticed something weird as of lately:

Some of my sites now serve cached files, no matter if you’re logged in or not. This is highly disturbing and inconsistent behavior.

I have found a few issues in my log files but am unsure what is happening:

2013/08/03 10:56:08 [error] 580034#0: *4 FastCGI sent in stderr: "PHP message: PHP Warning: opendir(): open_basedir restriction in effect. File(/var/run/nginx-cache) is not within the allowed path(s): (/var/www/clients/client9/web16/web:/var/www/clients/client9/web16/private:/var/www/clients/client9/web16/tmp:/var/www/exclusive-jumping.co.za/web:/srv/www/exclusive-jumping.co.za/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/php) in /var/www/clients/client9/web16/web/wp-content/plugins/nginx-helper/purger.php on line 684

PHP message: PHP Warning: opendir(/var/run/nginx-cache): failed to open dir: Operation not permitted in /var/www/clients/client9/web16/web/wp-content/plugins/nginx-helper/purger.php on line 684" while reading response header from upstream, client: 196.210.116.248, server: exclusive-jumping.co.za, request: “GET /wp-admin/index.php?nginx_helper_action=purge&nginx_helper_urls=all&_wpnonce=d7f73430f8 HTTP/1.1”, upstream: “fastcgi://unix:/var/lib/php5-fpm/web16.sock:”, host: “www.exclusive-jumping.co.za”, referrer: “http://www.exclusive-jumping.co.za/wp-admin/index.php

Now the question is why? This never happened before, your plugin was always able to delete the cache…

Any ideas?

Please refer to http://rtcamp.com/groups/wordpress-nginx/forum/topic/bug-in-nginx-helper/#post-44075 for answer.