We all know that WordPress doesn't scale, especially when we are using too many plugins. Caching is often the way to go but the downside of caching is that you have to wait for the cache to expires to see our changes. This plugin will delete from the cache all the pages that contains the new content so it will be immediately available.

Download: NGINX Manager for WordPress

How it works

NGINX Manager - Network schema

This plugin is meant to be used when you have one (or more) NGINX server in front of your applications servers. On your app. servers you can have Apache + mod_php or just FPM

Of course, for each combination the configurations change but the working idea is always the same and is very simple. We tell NGINX to serve all the requests for non logged users with a cached version (nothing very new until here) but the version is not deleted from the cache after a period of time but only when some new content is published !

So your app servers serve a specific request just once !

Here the information about how to setup:


  • Bash script for deleting an item or set of items from Nginx cache | View »

12 thoughts on “Cache WordPress site on NGINX and invalidate cache on demand

  1. A – M – A – Z – I – N – G.

    Thank you, thank you so much. You rock!

    Now that this plugin exist, and even media related to a post can be purged, then what's stopping us from setting cache valid to a day or more in nginx?

  2. I read around that nginx added support to cache purge into 0.8 branch, but there have been third party tools to purge the cache since it exist in the 0.7 branch.

    How is this module purging the cache? It would work on any branch with cache support?

  3. I'm having problems with installation of NGINX Manager 1.1. I keep getting this error:

    Call to undefined function get_blog_option() in /var/www/vhosts/example.com/httpdocs/wp-content/plugins/nginx-manager/nginx-manager.php on line 167

    WordPress v3.0.2. My blog is *NOT* a multisite install.

    • Thanks for reporting this. We are using the plugin only on multisite installations. We are fixing it to work on a single installation. I'll send you an update in the next days.

  4. Thanks, really appreciated. We're looking into moving to MultiSite later, but currently only run single sites. v1.0 still works fine on single site, but I was hoping to benefit from the recent changes in 1.1.

  5. Hi
    First, thanks on a great plugin.
    I been looking for a perfect caching plugin for a while and what I learn is that NGINX is the best way to go … but among very few of NGINX WP plugins yours seems to be closes to what I think is best cache option so I want to share with you a simple idea how to further maximize use of NGINX and to simplify invalidation rules.

    Imagine this scenario ….
    1. NGINX is setup as reverse proxy with far future expiration time
    2. All cached pages are purged only on admin logout

    What we get …
    1. Pages are cached only once
    2. 100% sure all is purged after logout
    3. Ability to test and change thing (themes, plugins, widgets, etc) with no change for outside world and without any other plugin

    So in a nutshell, instead of having cache that expires after some time and purge rules that works immediately after user action I thing that is better to have long lasting cache and purge rule that is triggered only once per session and that clear 100% of cached pages.

    In this way we keep server load at minimum cause there is only one cache purge and rebuild per session opposed for a multiple cache purge/build that is happening while we work on our blog.

    As for WPMU sites, we also keep newbie users of deciding what options to pick.

    Complete admin could be replaced with additional "LOG OFF AND ACTIVATE CHANGES" link next to standard "Log Off " link so that if we can purge cache manually and skip purging if we want.

    And in the end … plugin will be smaller, more stable (not saying now is not), easier to maintain, more understandable to use and 100% sure that always recent content is served to the visitors.

    Please tell me what do you thing about this idea … is there some things that I miss and is there any chance that you add this option in your plugin or make another fork of it ….. of course if you find idea worth working on.

    Thanks once again on NGINx manager, Marko

    • Hello Marko. What you want is not possible because the plugin do not create a static version of the site (this is what happen with Movable Type) but it only create a temporary version of some pages and only for users with no wordpress cookies.

      Don't worry because we, my colleague Marco Zanzotteta and I, have already started to work on a new feature to avoid cache purging each time a user does an operation that modify the site. With the new feature you will be able to control when trigger cache purging. This will reduce server load.

      If you, or other readers, have ideas to improve the plugin just leave a comment.

  6. Thanks a lot for this plugin. This is very useful.

    I am using your plugin on a fairly low volume website which has comments disabled. The cache is large and configured to keep cached copies for several days. As a result, it's fast as all pages are retrieved from the cache. Only when there's an update of an existing article or a new article, the affected pages are purged from the cache.

    Now I am looking into using a similar setup on a site that does have comments enabled. One thing that isn't clear from the documentation is that whether pages are purged from the cache when comments are added. Does it?

    • Which version are you using ? In the latest one (I can't remember when was added) in the "Setup" page for the plugin there is a section where you can specify if and which page purge when a new comment is *published* (not sent).

      You can decide to :

      Purge cache for the related page/post
      Purge cache for archive related to the page (date, category, tag, author)
      Purge cache for the related custom taxonomies

      Please note that when a user leave a comment WP set him a cookie, this avoid the user's request to hit the cache.


Leave a reply


<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>