How to set up Nginx Cache Controller

Here is how to use Nginx Cache Controller plugin.

Nginx Cache Controller

http://wordpress.org/plugins/nginx-champuru/

Nginx-Cache-Controller-Plugins

Amimoto AMI leverages Nginx reverse proxy to speed up the webpage display.

See: Performance

However, without controlling the reverse proxy cache, sometimes posts or comments are not displayed because of their cache.

Using Nginx Cache Controller, you can control the cache from the WordPress dashboard.

Usually you have to configure the setting of Nginx Cache Controller when you activate it, but for Amimoto AMI it is already configured.

How to Use

After activating the plugin, open the setting window of Nginx Cache from the menu.

The default setting of the expiration time is  86400 sec = 24 hours, so change it as you like.

Select “Yes” of “Enable Flush Cache”. When it is “No”, cache will not delete automatically.

Nginx-Cache1

When you select “Yes” here, you will see the further settings below.

If you use Amimoto AMI, you don’t have to change “Nginx Reverse Proxy Settings”

You can revise “Auto-Flush Hooks” and “Add Last modified” as you like.

Nginx-Cache2

Click the “Save” button.

Using WP-CLI

You can use WP-CLI to manage Nginx Cache Controller plugin.

  • For Amimoto AMI, it is available after Ver. 1.1.

Delete all the reverse proxy cache.

$wp nginx flush

List all the reverse proxy cache.

$wp nginx list

See Help.

$wp help nginx

Using a Separate Theme for Mobile.

Using a separate theme for mobile like WP Touch, you need to configure Nginx setting.

See: Using wptouch with Amimoto

Also, if you use both Amimoto AMI and Nginx Cache Controller, using Nginx Mobile Theme plugin you will just need only small settings to use a theme for mobile.

Nginx Mobile Theme

http://wordpress.org/plugins/nginx-mobile-theme/

Nginx-Mobile-Theme-Plugins

Nginx Mobile Theme is a plugin to switch a theme for mobile depending on a user agent under Nginx reverse proxy.

When a post is saved or comments are posted, it will delete cache for both mobile and PC.

Also, you can specify a theme under wp-content/themes for mobile, which means you can create a child theme of a theme for PC.

To use the plugin with Amimoto AMI, you need to change 2 settings of Nginx besides enabling the plugin.

First of all, remove the comment out at line 17,  /etc/nginx/conf.d/default.conf and add setting to determine mobile agents,

Before changing:

#include /etc/nginx/mobile-detect;

After changing:

include /etc/nginx/mobile-detect;

Next, add the line below to /etc/nginx/nginx.conf, to send the result from the reverse proxy to WordPress.

Before changing:

proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
proxy_set_header  Accept-Encoding    "";

After changing:

proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
proxy_set_header  Accept-Encoding    "";
proxy_set_header  X-UA-Detect        $mobile; # add this line
  • You need to add the setting to wp-config.php, but Amimoto AMI is already configured.

After setting the above, the menu item “Mobile Theme” is added to Themes > Customize, and you can choose a theme for mobile.

Nginx-Mobile-Theme-Plugins2

See also: Nginx Mobile Theme | firegoby


To speed up your website display with Amimoto AMI + WordPress and reverse proxy, activate Nginx Cache Controller!