Learn about Centmin Mod LEMP Stack today
Register Now

Wordpress Cache-Enabler Plugin WP Cacher Enabler Plugin by KeyCDN folks

Discussion in 'Blogs & CMS usage' started by eva2000, Dec 2, 2015.

  1. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    where you get that error ? what were you doing or typing at the time ? how was wordpress installed ? if it's installed via centmin.sh menu option 22 in 123.09beta01 you do not need to do anything if you selected keycdn cache enabler at wordpress install time in menu option 22

    that isn't a command to run that is cronjob entry to add to cronjob


    use crontab -e command to invoke nano text editor to add the line making sure to replace $vhostname and mydomain.net with your domain name see guide at HowTo: Add Jobs To cron Under Linux or UNIX?

    Easiest way to edit configuration or any files on your server is via logging into your server via ssh and directly editing them using nano or vim linux text editors. For nano which you can read up more about nano here and here. For vim text editor read here and here.
     
    Last edited: Nov 14, 2016
  2. emre22

    emre22 Member

    44
    5
    8
    Oct 15, 2016
    Ratings:
    +5
    Local Time:
    5:36 AM
    nginx-1.10.1
    MariaDB 10
    I typed it into my ssh console as root. Yes, I installed this via option 22 and followed your guide how to switch to keycdn cache enabler...
     
  3. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    that isn't a command to run that is cronjob entry to add to cronjob

    use crontab -e command to invoke nano text editor to add the line making sure to replace $vhostname and mydomain.net with your domain name see guide at HowTo: Add Jobs To cron Under Linux or UNIX?

    Easiest way to edit configuration or any files on your server is via logging into your server via ssh and directly editing them using nano or vim linux text editors. For nano which you can read up more about nano here and here. For vim text editor read here and here.
     
  4. raciasolvo

    raciasolvo Member

    98
    10
    8
    Oct 7, 2016
    Ratings:
    +27
    Local Time:
    6:36 AM
    Nginx 1.11.6
    MariaDB 10.0.27
    Hm, my post pages cached. May be I edited try_files:
    Code (Text):
        location    /               {
            rewrite ^(/.*)/$        $1 permanent;
            access_log              /home/nginx/domains/domain.tld/log/access.log combined buffer=256k flush=60m;
            #try_files              /path_to_wp/wp-content/cache/cache-enabler/www.domain.tld/${request_uri}/index${webp_suffix}.html /index.php?$args;
            try_files               /path_to_wp/wp-content/cache/cache-enabler/www.domain.tld/${request_uri}/index.html /index.php?$args;
        }
    

    I do not use the include and all pages cache.
     
    Last edited: Nov 15, 2016
  5. ndha

    ndha Member

    82
    10
    8
    Sep 28, 2014
    Ratings:
    +29
    Local Time:
    10:36 AM
    Latest
    10
    Hi @eva2000 and all member who use Cache Enabler..
    Had all of you realize something when update to latest Cache Enabler??
    3 of my sites using Cache Enabler with Centmin 22 Option to not Cache Mobile Device..

    After Cache Enabler plugin update 2 days ago, suddenly 3 of my sites can't see any update posts if browse using Mobile Device..I must manually Clear Cache if i want to see those updates by Mobile..
    This is never happening when using Old Cache Enabler Plugin before update..
     
  6. Razib Hasan

    Razib Hasan Premium Member Premium Member

    37
    15
    8
    May 31, 2014
    Dhaka, Bangladesh
    Ratings:
    +15
    Local Time:
    9:36 AM
    1.7.6
    5.10
    I'm getting error 500 while browsing on mobile. I had to disable Cache Enabler.
     
  7. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    interesting usually I remember at centmin.sh menu option 22 install time to opt to NOT cache for mobile - so usually you won't see problems. There were updates to Cache Enabler keycdn/cache-enabler so will need to see what changed.

    Can folks with issues post output of these 2 commands in CODE tags
    Code (Text):
    cd /home/nginx/domains/your_wp_domain.com/public
    wp option get cache-enabler --format=yaml
    

    change /home/nginx/domains/your_wp_domain.com/public to where ever wordpress is installed i.e. directory that wp-config.php is located in
     
  8. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Seems latest updates had some bugs for some folks too View: [Cache Enabler - WordPress Cache] Support | WordPress.org

    i.e. Topic: 500 Error when updating to 1.2.3 on WP Multisite with domain mapping | WordPress.org
    You can try just uninstall/installing cache enabler plugin again via SSH command line
    Code (Text):
    wpinstall_dir='/home/nginx/domains/your_wp_domain.com/public'
    cd $wpinstall_dir
    wp plugin uninstall cache-enabler --allow-root
    wp plugin install cache-enabler --activate --allow-root
    wp option update cache-enabler '{"expires":6,"new_post":1,"new_comment":1,"webp":0,"clear_on_upgrade":1,"compress":1,"excl_ids":"","excl_regexp":"","excl_cookies":"","excl_querystrings":"","minify_html":0}' --format=json --allow-root
    chown -R nginx:nginx ${wpinstall_dir}/wp-content/plugins/
    

    change /home/nginx/domains/your_wp_domain.com/public to where ever wordpress is installed i.e. directory that wp-config.php is located in

    Also looks like new option exists to clear complete cache if any plugin has been upgraded. Try checking that box and hitting save and see what happens

    cache-enabler-new-option.png

    old cache-enabler options
    Code (Text):
    wp option get cache-enabler --format=yaml
    ---
    expires: 24
    new_post: 1
    new_comment: 1
    webp: 0
    compress: 1
    excl_ids: ""
    minify_html: 0
    

    new cache-enabler options with new regex exclusions
    Code (Text):
    wp option get cache-enabler --format=yaml
    ---
    expires: 24
    new_post: 1
    new_comment: 1
    webp: 0
    clear_on_upgrade: 1
    compress: 1
    excl_ids: ""
    excl_regexp: ""
    excl_cookies: ""
    excl_querystrings: ""
    minify_html: 0
    


     
    Last edited: Aug 27, 2018
  9. ndha

    ndha Member

    82
    10
    8
    Sep 28, 2014
    Ratings:
    +29
    Local Time:
    10:36 AM
    Latest
    10
    After did exactly you posted nothing is changed..
    We can't see Post update in homepage when using Mobile browser (test with default browser and Chrome)..
    So i must clear cache manually after update post for Mobile visitors..
     
  10. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    what's output for
    Code (Text):
    wpinstall_dir='/home/nginx/domains/your_wp_domain.com/public'
    cd $wpinstall_dir
    wp option get cache-enabler --format=yaml
    

    change /home/nginx/domains/your_wp_domain.com/public to where ever wordpress is installed i.e. directory that wp-config.php is located in
    output for contents in cache enabler include file in your nginx vhost at /usr/local/nginx/conf/wpincludes/your_wp_domain.com/wpcacheenabler_your_wp_domain.com.conf
    i.e. output for command
    Code (Text):
    cat /usr/local/nginx/conf/wpincludes/your_wp_domain.com/wpcacheenabler_your_wp_domain.com.conf
    

    you should have line for mobile cache exclusion like (ignore reference to redis it's for cache_enabler)
    Code (Text):
        # exclude mobile devices from redis caching
        if ($cmwpcache_device = mobile) { set $cache_uri 'nullcache'; }
    

    double check your /usr/local/nginx/conf/nginx.conf still has the cache enabler mobile map include file /usr/local/nginx/conf/wpcacheenabler_map.conf
    Code (Text):
    include /usr/local/nginx/conf/wpcacheenabler_map.conf;
    

    and it's contents has
    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';
    }
    
     
  11. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
  12. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    not sure if same issue but ran into 500 error just now and it doesn't seem to be cache enabler related. It was clearfy wp plugin causing 500 error, after deactivating it and restarting nginx + php-fpm it worked but i did do the reinstall of cache enabler too so the whole thing was

    deactive cache-enabler, uninstall and re-install and run updated cache enabler options update + deactivate clearfy if you use clearfy
    Code (Text):
    wpinstall_dir='/home/nginx/domains/your_wp_domain.com/public'
    cd $wpinstall_dir
    wp plugin deactivate cache-enabler --allow-root
    wp plugin uninstall cache-enabler --allow-root
    wp plugin install cache-enabler --activate --allow-root
    wp option update cache-enabler '{"expires":6,"new_post":1,"new_comment":1,"webp":0,"clear_on_upgrade":1,"compress":1,"excl_ids":"","excl_regexp":"","excl_cookies":"","excl_querystrings":"","minify_html":0}' --format=json --allow-root
    wp plugin deactivate clearfy --allow-root
    chown -R nginx:nginx ${wpinstall_dir}/wp-content/plugins/
    nprestart
    


    seems maybe some clearfy wp plugin update Clearfy – WordPress optimization plugin and disable ultimate tweaker causing issues

    edit: seems if you then activate clearfy in wp admin it all works !
     
    Last edited: Aug 31, 2018
  13. ndha

    ndha Member

    82
    10
    8
    Sep 28, 2014
    Ratings:
    +29
    Local Time:
    10:36 AM
    Latest
    10
    Ohhh forgot to reply back about the issue in here, at that time problem still there even after update the plugin, also i don't use clearfy..
    Even i restart the server, problem still there..
    So i decide to change the cache methode, and problem is gone..
     
  14. shevan

    shevan New Member

    13
    2
    3
    Nov 7, 2018
    Ratings:
    +4
    Local Time:
    6:36 AM
    Nginx 15.5
    MariaDB 10
    Hi

    it seems like nginx does not send cached pages to my site.
    missing status line <!-- Cache Enabler by KeyCDN @ .... (html gzip) -->

    big TTFB (~1sec)
    I am using cloudflare.

    I also tried WP Super Cache. Same situation as with Cache Enabler, no status line, big ttfb.
    Both plugins are working correctly on my localhost machine (apache2 + mod-php7.2)

    Wordpress installed through menu 22 option + Cache Enabler. Site imported with duplicator.

    what can I check?
     
    Last edited: Nov 9, 2018
  15. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    @shevan

    If you're logged into Wordpress you won't get Cache Enablered caching, only for logged out guests. So test in Incognito Chrome private session.

    Any Cloudflare page rules in place ? what onces ?

    When was centmin.sh menu option 22 install done ? how long ago ? Cache Enabler did have issues with a recent update, you can go into it's settings and re-save them to ensure the updated versions new settings are in place.

    If you imported via duplicator, make sure file/directory user/group permissions are owned by nginx you can change them using command
    Code (Text):
    chown -R nginx:nginx /home/nginx/domains/yourdomain.com/public
    


    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)

    what is output of these commands in ssh
    Code (Text):
    curl -I https://domain.com
    

    Code (Text):
    curl -I https://www.domain.com
    

    Code (Text):
    curl -I http://domain.com
    

    Code (Text):
    curl -I http://www.domain.com
    

    wrap output in CODE tags
     
  16. shevan

    shevan New Member

    13
    2
    3
    Nov 7, 2018
    Ratings:
    +4
    Local Time:
    6:36 AM
    Nginx 15.5
    MariaDB 10
    Yes, I did tests in incognito mode.

    file and group permissions are correct.

    I replaced my domain with example.com
    Code:
    #x# HTTPS-DEFAULT
     server {
     
       server_name example.com www.example.com;
       return 302 https://example.com$request_uri;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    
    server {
      listen 443 ssl http2;
      server_name example.com www.example.com;
    
      include /usr/local/nginx/conf/ssl/example.com/example.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      # cloudflare authenticated origin pull cert community.centminmod.com/threads/13847/
      #ssl_client_certificate /usr/local/nginx/conf/ssl/cloudflare/example.com/origin.crt;
      #ssl_verify_client on;
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_ciphers ****;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      add_header X-Xss-Protection "1; mode=block" always;
      add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/example.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/example.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/example.com/autoprotect-example.com.conf;
      root /home/nginx/domains/example.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      include /usr/local/nginx/conf/wpincludes/example.com/wpcacheenabler_example.com.conf;
      #include /usr/local/nginx/conf/wpincludes/example.com/wpsupercache_example.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/example.com/rediscache_example.com.conf;
    
      location / {
      rewrite "^/([^/]+).html$" https://example.com/$1 permanent;
    
      include /usr/local/nginx/conf/503include-only.conf;
     
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        auth_basic "Private";
        auth_basic_user_file /home/nginx/domains/example.com/htpasswd_wplogin;
        include /usr/local/nginx/conf/php-wpsc.conf;
     
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
     
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-scripts\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
     
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-styles\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
     
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/example.com/wpsecure_example.com.conf;
      include /usr/local/nginx/conf/php-wpsc.conf;
     
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/pre-staticfiles-local-example.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    Page rules on cloudflare:
    Code:
    1. http://example.com/* - Always Use HTTPS
    2. *example.com/wp-admin/* - Disable Security, Browser Cache TTL: 4 hours, Always Online: Off, Cache Level: Bypass, Disable Apps, Disable Performance
    Code:
    curl -I http://example.com
    HTTP/1.1 301 Moved Permanently
    Date: Fri, 09 Nov 2018 13:37:38 GMT
    Connection: keep-alive
    Cache-Control: max-age=3600
    Expires: Fri, 09 Nov 2018 14:37:38 GMT
    Location: https://example.com/
    Server: cloudflare
    CF-RAY: 4770acda65228e9d-DME
    
    Code:
    curl -I https://example.com
    HTTP/1.1 200 OK
    Date: Fri, 09 Nov 2018 13:38:55 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Set-Cookie: __cfduid=d7c5bcd00157c6d35a4b4c2cab06a20761541770735; expires=Sat, 09-Nov-19 13:38:55 GMT; path=/; domain=.example.com; HttpOnly
    Last-Modified: Fri, 09 Nov 2018 11:10:54 GMT
    Vary: Accept-Encoding
    X-Powered-By: centminmod
    X-Xss-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Server: cloudflare
    CF-RAY: 4770aeb64c629059-DME
    
     
    Last edited: Nov 9, 2018
  17. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    looks good config wise.. what's output for command to check cache enabler cache directory contents
    Code (Text):
    ls -Alh /home/nginx/domains/yourdomain.com/public/wp-content/cache/
    
    ls -Alh /home/nginx/domains/yourdomain.com/public/wp-content/cache/cache-enabler
    
    ls -Alh /home/nginx/domains/yourdomain.com/public/wp-content/cache/cache-enabler/yourdomain.com/
    
     
  18. shevan

    shevan New Member

    13
    2
    3
    Nov 7, 2018
    Ratings:
    +4
    Local Time:
    6:36 AM
    Nginx 15.5
    MariaDB 10
    Static pages exist.
    permissions are 755 nginx:nginx

    I don't know how to share image here.

    Lines I changed/added in standard config as I could remember

    Code:
    listen 443 ssl http2;
    ...
    rewrite "^/([^/]+).html$" https://example.com/$1 permanent;
    ...
    include /usr/local/nginx/conf/cloudflare.conf;
    
    btw, why curl shows http/1.1?
     
  19. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,631
    Local Time:
    1:36 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    native CentOS curl version as a client doesn't support HTTP/2 so HTTP/1.1 is used.

    see the upload a file button

    directories or files, files should be 644 and directories 755 but if static pages created in
    /home/nginx/domains/yourdomain.com/public/wp-content/cache/cache-enabler/yourdomain.com/ exist, then cache is working make sure inc cache enabler settings you check box which saves the html comment.
     
  20. shevan

    shevan New Member

    13
    2
    3
    Nov 7, 2018
    Ratings:
    +4
    Local Time:
    6:36 AM
    Nginx 15.5
    MariaDB 10
    I did a fresh WordPress install for testing purposes through centmin 22 option. Cache works.

    I have no ideas.
    Both WP Super Cache and Cache Enabler for main site do not work.
    Cached pages are created but not served.
    I made this assumption based on the long response of the server and missing status line.
    But they works at the localhost.