WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Using nginx + varnish, cache not being purged (8 posts)

  1. whatsthatbug.com
    Member
    Posted 2 years ago #

    I changed out our software over the last few days. Went from Apache to Varnish + Nginx + PHP-FPM with APC and Memcache. The performance difference is insane!

    But... new posts or changes to existing posts are not being reflected on the main page. If I make a change to a post, it appears that the post itself gets purged, but not the front page.

    I have "Enable varnish cache purging" checked, and the IP address of the varnish server entered. And like I said, the post itself seems to get purged.

    Anyone else run across this?

  2. Gilligan
    Member
    Posted 2 years ago #

    My only suggestion would be to NOT cache your front page, since your setup should provide some level of caching for your front page without also caching in w3tc. Try it and let us know your results?

    Please keep this thread updated, I am following it, and am very interested in your setup for some future deployments. I have been holding off on testing that configuration until there is better support for nginx with w3tc.

  3. whatsthatbug.com
    Member
    Posted 2 years ago #

    @Gilligan, thanks for the suggestion. That does work for now.

    There are a few things that aren't quite right with nginx, but for the most part I'm thrilled. For one, the menu bar across the top does not show up if I'm logged in.

    Another, more major problem is that wptouch pro, which is a mobile theme for phones, does not appear to work at all with this setup. I'm really hoping to get that one figured out!

  4. Gilligan
    Member
    Posted 2 years ago #

    wptouch would rely on user-agent string interpretation & passing it to the plugin, so you should hit up the nginx forums to troubleshoot that issue. Having so many layers in play, it's difficult to determine how that would get passed to and from varnish & nginx

    Do you really need memcache? I'd remove that from the mix if you don't have your database server on a separate node.

  5. whatsthatbug.com
    Member
    Posted 2 years ago #

    I found a better place in the stack to do the redirect: varnish.

    In sub vcl_recv, I added:

    if ( req.http.user-agent ~
    "(.*iphone.*|.*ipod.*|.*incognito.*|.*webmate.*|.*android.*|.*dream.*|.*cupcake.*|.*froyo.*|.*blackberry9500.*|.*black$
            {
              set req.http.newhost = regsub(req.http.host, "(www)?.(.*)", "http://m.2");
              error 750 req.http.newhost;
            }

    And then

    sub vcl_error {
            if (obj.status == 750) {
              set obj.http.Location = obj.response;
              set obj.status = 302;
              return(deliver);
            }
    }

    I hope this helps someone else!

  6. Frederick Townes
    Member
    Plugin Author

    Posted 2 years ago #

    The next release improves varnish purging significantly.

  7. whatsthatbug.com
    Member
    Posted 2 years ago #

    Thanks, Frederick! Is that release fairly imminent?

  8. Frederick Townes
    Member
    Plugin Author

    Posted 2 years ago #

    Yes.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic