Discover Centmin Mod today
Register Now

Disable keyCDN mobile caching for site already created with option 22

Discussion in 'Blogs & CMS usage' started by Keroteta, Aug 4, 2019.

  1. Keroteta

    Keroteta New Member

    12
    0
    1
    Aug 2, 2019
    Ratings:
    +0
    Local Time:
    8:42 PM
    nginx/1.17.2 (280719-043529-centos7-kvm)
    10.3.17-MariaDB
    Hi there,

    I have already moved 4 Wordpress sites from my old server to the new one with Centmin Mod and everything runs flawlessly except for one thing. I created the 4 vhost with option 22 of centmin, but the first 2 I choose to use Keycdn cache enabler also with the mobile version. The other 2 I decided to disable mobile caching. Now after a few tests I'd like to disable mobile caching for the first 2 sites because I noticed a possible glitch, but without reinstalling everything. Is it possible? If so, what do I have to do to disable Keycdn mobile caching after using option 22?

    I have read in other post that it's only a matter of uncommenting a line at file /usr/local/nginx/conf/wpincludes/${vhostname}/wpcacheenabler_${vhostname}.conf

    Code:
    # exclude mobile devices from redis caching
        if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    but when I go to that file for any of those four domains they ALL have that line uncommented. Weren´t supposed to be 2 commented and the other 2 uncommented? Does that mean that no one is caching mobile versions even when I choose 2 of them do so?

    If so if I view source code of those four sites on my mobile phone, they all have the keyCDN timestamp at the end of the file???? So the four are caching????

    I'm confused now. I don´t know if I have two, four or no one caching mobile version of my sites. Also I have to say that all four sites are responsive, no one has a different from desktop version, just a responsive design. I don´t know if this is important or no.
     
  2. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,189
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,098
    Local Time:
    4:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    • to disable mobile cache exclusion, you comment out that line with hash # in front not uncomment
    • to enable mobile cache exclusion, you uncomment out that like removing hash # in front
    you can double check what you answered at initial centmin.sh menu 22 option run via /root/centminlogs for wordpress_addvhost.log logs which record the entire process
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep wordpres

    example log at /root/centminlogs/centminmod_123.09beta01.b203_120719-221749_wordpress_addvhost.log
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep wordpress
    -rw-r--r--   1 root root  48K Jul 12 22:28 centminmod_123.09beta01.b203_120719-221749_wordpress_addvhost.log
    

    grep
    Code (Text):
    grep -i 'Do you want to exclude mobile' /root/centminlogs/centminmod_123.09beta01.b203_120719-221749_wordpress_addvhost.log
    Do you want to exclude mobile/tablet devices from Cache Enabler caching ? [y/n]: y
    
     
  3. Keroteta

    Keroteta New Member

    12
    0
    1
    Aug 2, 2019
    Ratings:
    +0
    Local Time:
    8:42 PM
    nginx/1.17.2 (280719-043529-centos7-kvm)
    10.3.17-MariaDB
    I have just checked 2 of those logs, the first one says:

    Code:
    Do you want to exclude mobile/tablet devices from Cache Enabler caching ? [y/n]: n
    and the code I find for its domain is:

    Code:
    # exclude mobile devices from redis caching
        if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    Then checked a second log, for another domain and it says:

    Code:
    Do you want to exclude mobile/tablet devices from Cache Enabler caching ? [y/n]: y
    For this one what I find in its .conf file is:

    Code:
    # exclude mobile devices from redis caching
        if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    So same lines even when I answered different during initial setup with option 22!!

    Also again while viewing both domains with a mobile device in both cases I can see the KeyCDN timestamp so I'm viewing cached versions. So if I'm not wrong those are two issues. The first one is why are both equal if I answered different. And the second question is why I'm seeing cached versions on mobile if those lines with no # mean mobile cache exclusion is active???
     
  4. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,189
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,098
    Local Time:
    4:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you found a bug ! will update 123.09beta01 with the fix in a ~15 minutes. for now just manually make the appropriate changes. Then run cmupdate command to update 123.09beta01. The fix will correct it for new centmin.sh menu option 22 runs
    Code (Text):
    cmupdate
    No local changes to save
    remote: Enumerating objects: 11, done.
    remote: Counting objects: 100% (11/11), done.
    remote: Compressing objects: 100% (1/1), done.
    remote: Total 6 (delta 5), reused 6 (delta 5), pack-reused 0
    Unpacking objects: 100% (6/6), done.
    From https://github.com/centminmod/centminmod
       5331676..596d557  123.09beta01 -> origin/123.09beta01
    Updating 5331676..596d557
    Fast-forward
     centmin.sh                    | 2 +-
     inc/wpsetup-fastcgi-cache.inc | 4 ++--
     inc/wpsetup.inc               | 4 ++--
     3 files changed, 5 insertions(+), 5 deletions(-)
    
     
  5. Keroteta

    Keroteta New Member

    12
    0
    1
    Aug 2, 2019
    Ratings:
    +0
    Local Time:
    8:42 PM
    nginx/1.17.2 (280719-043529-centos7-kvm)
    10.3.17-MariaDB
    Many thanks eva2000. I will patch my centmin.sh when update is available.

    But regarding the manual changes for my four sites, if I want all of them with mobile caching disabled the code should be:

    Code:
    # exclude mobile devices from redis caching
        if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    Right? But that's how they actually have it, so no changes for me, and I think that it is not working at all. I keep seeing cache enabler timestamp on source code of all four sites when viewing on mobile. Are there any other manual changes that I should make apart from that one?

    Sorry for bothering, just want to understand and make it work properly. I very much appreciate your help.
     
  6. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,189
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,098
    Local Time:
    4:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ;)
     
  7. Keroteta

    Keroteta New Member

    12
    0
    1
    Aug 2, 2019
    Ratings:
    +0
    Local Time:
    8:42 PM
    nginx/1.17.2 (280719-043529-centos7-kvm)
    10.3.17-MariaDB
    Don´t know if I'm missing something else... :(:(:(

    With or without # I always see the keyCDN cache enabler timestamp...
    With:
    Code:
    # exclude mobile devices from redis caching
        if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    And with:
    Code:
    # exclude mobile devices from redis caching
       #if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    I get the same result.. keycdn timestamp on source. I executed nprestart after every change and I do everything as root user, so I really don´t know what I'm doing wrong. Also deleted the browser cache of my mobile device.
     
  8. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,189
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,098
    Local Time:
    4:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    need to purge keycdn cache enable cache from wp-admin
     
  9. Keroteta

    Keroteta New Member

    12
    0
    1
    Aug 2, 2019
    Ratings:
    +0
    Local Time:
    8:42 PM
    nginx/1.17.2 (280719-043529-centos7-kvm)
    10.3.17-MariaDB
    Tried that already, nprestart, cleared Autoptimize caché, also cleared cache enabler using the save options button, cleared browser cache, even tried with and without WiFi connection. Weird thing is that the timestamp continues appearing and also says is from an hour or so ago. It's serving an old version even if I supposedly removed all caches...

    Could it be other cache system making funny things?
     
  10. eva2000

    eva2000 Administrator Staff Member

    41,080
    9,189
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,098
    Local Time:
    4:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    are you viewing via mobile or desktop, there's only limited number mobile user agents checked for in /usr/local/nginx/conf/wpcacheenabler_map.conf which is included in /usr/local/nginx/conf/nginx.conf
    Code (Text):
    grep wpcacheenabler_map.conf /usr/local/nginx/conf/nginx.conf
    include /usr/local/nginx/conf/wpcacheenabler_map.conf;
    

    contents of /usr/local/nginx/conf/wpcacheenabler_map.conf
    Code (Text):
    map $http_user_agent $cmwpcache_device {
        default                                     'desktop';
        ~*(iPad|iPhone|Android|IEMobile|Blackberry) 'mobile';
        "~*Firefox.*Mobile"                         'mobile';
        "~*ipod.*mobile"                            'mobile';
        "~*Opera\ Mini"                             'mobile';
        "~*Opera\ Mobile"                           'mobile';
        "~*Mobile"                                  'mobile';
        "~*Tablet"                                  'mobile';
        "~*Kindle"                                  'mobile';
        "~*Windows\ Phone"                          'mobile';
    }
    

    if visiting from desktop then it will show cached version with timestamp
     
  11. Keroteta

    Keroteta New Member

    12
    0
    1
    Aug 2, 2019
    Ratings:
    +0
    Local Time:
    8:42 PM
    nginx/1.17.2 (280719-043529-centos7-kvm)
    10.3.17-MariaDB
    From Android mobile, Chrome.