Using WPtouch with Amimoto

Amimoto uses reverse proxy or Nginx to make your site faster.
Therefore, by default, it uses the same cache for any User Agent.
So, with the default settings, it will have a problem when you try to show different content by different User Agent like WPtouch plugin.

Here is the solution:

Caching with the Key for Mobile Devices.

Modify the Nginx’s config file which is automatically generated by Amimoto.
In the file of
/etc/nginx/conf.d/default.conf
or
/etc/nginx/conf.d/example.com.conf ( example.com means virtual domain name )

modify like below:

server {
    listen 80 default;
    server_name _;
    root /var/www/vhosts/$host;
    index index.html index.htm;
    charset utf-8;
 
    access_log /var/log/nginx/$host.access.log main;
    error_log /var/log/nginx/$host.error.log;
 
    include /etc/nginx/drop;
 
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    #rewrite ^(.*)(index|home|default)\.html? $1 permanent;
 
    set $mobile '';
    include /etc/nginx/mobile-detect;      # remove # at the line head
 
:

Remove # at the line head of #include /etc/nginx/mobile-detect;
Then enter # service nginx restart to restart Nginx to refresh the settings.

Deleting Cache for Mobile Devices with Nginx Cache Controller

Add the below code to functions.php of your theme.

<?php
add_filter('nginxchampuru_get_cache', 'nginxchampuru_get_cache', 10, 2);
function nginxchampuru_get_cache($key, $url = null) {
    global $nginxchampuru;
    if (!$url) {
        $url = $nginxchampuru->get_the_url();
    }
    $keys = array(
        $key,
        $nginxchampuru->get_cache_key($url.'@ktai'),
        $nginxchampuru->get_cache_key($url.'@smartphone'),
    );
    if ($key !== $nginxchampuru->get_cache_key($url)) {
        $keys[] = $nginxchampuru->get_cache_key($url);
    }
    return $nginxchampuru->get_cache_file($keys);
}

This code will delete the cache for mobile devices when Nginx Cache Controller delete other cache.