Discover Centmin Mod today
Register Now

Wordpress Memcached + WPFFPC not working

Discussion in 'Blogs & CMS usage' started by coldice, Dec 16, 2017.

  1. coldice

    coldice Member

    35
    1
    8
    Nov 27, 2017
    India
    Ratings:
    +2
    Local Time:
    5:41 AM
    1.13.7
    10.1.29
    Hello,

    I was configuring Memcached + WPFFPC + pagespeed from this thread:
    Nginx Wordpress + WP-FFPC Plugin + ngx_pagespeed - CentminMod.com LEMP Nginx web stack for CentOS

    I have only configured till WPFFPC. When I run curl -I domain I get the following data:
    Code:
    Server: nginx centminmod
    X-Powered-By: centminmod
    X-Cache: MISS
    X-Cache-2: BYPASS
    Strict-Transport-Security: max-age=31536000; includeSubdomains;
    There's still more of it but X-Cache shows Miss and when I open memcached server stat page
    [​IMG]

    I think I have configured memcached + WPFFPC correctly.
    I have entered the correct login details on plugin page also:
    [​IMG]

    Is there something I missed?

    Note:
    I installed wordpress from option 22 + redis.
    I've deactivated nginx helper + redis object cache plugin. But redis settings in domain vhost still exist.

    Current domain vhost file:

    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
     server {
       server_name domain.com www.domain.com;
        return 302 https://domain.com$request_uri;
    # define error page
    error_page 404 = @notfound;
    
    # error page location redirect 301
    location @notfound {
        return 301 /;
    }
    location / {
    include /usr/local/nginx/conf/wpsecure.conf;
    include /usr/local/nginx/conf/wpnocache.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
    # Enables directory listings when index file not found
    autoindex on;
    
    try_files $uri $uri/ @memcached;
    
    }
    
     }
    
    server {
      listen 443 ssl http2;
      server_name domain.com www.domain.com;
     ##  redirect https www to https non-www
          if ($host = 'www.domain.com' ) {
             return 302 https://domain.com$request_uri;
          }
      ssl_dhparam /usr/local/nginx/conf/ssl/domain.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/domain.com/ssl-unified.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/domain.com/domain.com.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # dual cert supported ssl ciphers
      ssl_ciphers     EECDH+CHACHA20-draft:EECDH+CHACHA20:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EE$
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      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;
      #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;
     ssl_trusted_certificate /usr/local/nginx/conf/ssl/domain.com/ssl-trusted.crt;
    
    # 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/domain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf;
      root /home/nginx/domains/domain.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/domain.com/wpcacheenabler_domain.com.conf;
      #include /usr/local/nginx/conf/wpincludes/domain.com/wpsupercache_domain.com.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/wpincludes/domain.com/rediscache_domain.com.conf;
    
      location / {
      #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;
      #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/domain.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;
    }
    
      include /usr/local/nginx/conf/wpincludes/domain.com/wpsecure_domain.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/wpffpc.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      #include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/wpffpc.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      #include /usr/local/nginx/conf/php.conf;
      #include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
      include /usr/local/nginx/conf/sitemap-config.conf;
    }
    
    
    
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,050
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    10:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you're still reference redis related caching include files for

    include /usr/local/nginx/conf/wpincludes/domain.com/rediscache_domain.com.conf;

    and for

    include /usr/local/nginx/conf/php-rediscache.conf;

    change it back to default include file for each referenced instance as

    include /usr/local/nginx/conf/php.conf;
     
  3. coldice

    coldice Member

    35
    1
    8
    Nov 27, 2017
    India
    Ratings:
    +2
    Local Time:
    5:41 AM
    1.13.7
    10.1.29
    I removed redis from domain vhost file.
    Now in WP-FFPC log tab I can see my posts are being are cached and memcached server space is also being used. But in headers
    X-Pingback: http://yourdomain.com/wp/xmlrpc.php
    X-Cache-Engine: WP-FFPC with memcached via PHP
    are not appearing anymore.

    I've enabled header settings also in FFPC plugin.
    [​IMG]

    When I enter my post link in:
    Page Cache Test | SeoSiteCheckup.com

    It says the cached page is not served.
     
  4. eva2000

    eva2000 Administrator Staff Member

    36,050
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    10:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  5. coldice

    coldice Member

    35
    1
    8
    Nov 27, 2017
    India
    Ratings:
    +2
    Local Time:
    5:41 AM
    1.13.7
    10.1.29
    I followed if perfectly and all the changes that are written on that page are applied correctly.

    When I run curl on homepage curl -I Domain Name Registration and Web Hosting | Domain.com
    It gives

    Code:
    HTTP/1.1 200 OK
    Date: Sat, 16 Dec 2017 17:57:48 GMT
    Content-Type: text/html;charset=utf-8
    Connection: keep-alive
    Vary: Accept-Encoding
    Expires: Sat, 16 Dec 2017 17:57:48 GMT
    Link: <https://wp.me/P9f3vh-zZ3>; rel=shortlink
    Last-Modified: Fri, 15 Dec 2017 19:23:06 GMT
    X-Cache-Engine: WP-FFPC with memcached via PHP
    Server: nginx centminmod
    X-Powered-By: centminmod
    Strict-Transport-Security: max-age=31536000; includeSubdomains;
    Post curl curl -I https://domain.com/65125
    Code:
    HTTP/1.1 200 OK
    Date: Sat, 16 Dec 2017 17:59:05 GMT
    Content-Type: text/html;charset=utf-8
    Connection: keep-alive
    Vary: Accept-Encoding
    Expires: Sat, 16 Dec 2017 17:59:05 GMT
    Link: <https://wp.me/p9f3vh-40p>; rel=shortlink
    Last-Modified: Tue, 10 Oct 2017 17:19:05 GMT
    X-Cache-Engine: WP-FFPC with memcached via PHP
    Server: nginx centminmod
    X-Powered-By: centminmod
    
    But at end of URL when I use slash it removes X-Cache with 301 Moved Permanently:
    Code:
    HTTP/1.1 301 Moved Permanently
    Date: Sat, 16 Dec 2017 17:59:57 GMT
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Location: https://jansandeshonline.com/15401
    Server: nginx centminmod
    X-Powered-By: centminmod
    Strict-Transport-Security: max-age=31536000; includeSubdomains;
    
     
  6. coldice

    coldice Member

    35
    1
    8
    Nov 27, 2017
    India
    Ratings:
    +2
    Local Time:
    5:41 AM
    1.13.7
    10.1.29
    I worked around and also configured pagespeed.
    Here are my stats:
    [​IMG]

    Is my FFPC + pagespeed working?
     
  7. eva2000

    eva2000 Administrator Staff Member

    36,050
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    10:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    So you fixed this issue ? If not, please post the updated current 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)

    As to pagespeed look into pagespeed admin console's message logs which you can enable. You'd have to troubleshoot and tweak it yourself following these guides and info outlined below
     
  8. coldice

    coldice Member

    35
    1
    8
    Nov 27, 2017
    India
    Ratings:
    +2
    Local Time:
    5:41 AM
    1.13.7
    10.1.29
    I did fixed it myself by reading the articles on centminmod :)
    Now on Page Cache Test | SeoSiteCheckup.com it shows server is sending cached page.
    Is there any specific guide for Wordpress + pagespeed that you have tried? Because I cen't get any valuable article on internet for this.
    domain.com.ssl.conf
    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
     server {
       server_name domain.com www.domain.com;
        return 302 https://domain.com$request_uri;
    # define error page
    error_page 404 = @notfound;
    
    # error page location redirect 301
    location @notfound {
        return 301 /;
    }
    
    location / {
    include /usr/local/nginx/conf/wpsecure.conf;
    include /usr/local/nginx/conf/wpnocache.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
    # Enables directory listings when index file not found
    autoindex on;
    
    try_files $uri $uri/ @memcached;
    
    }
    
     }
    
    server {
      listen 443 ssl http2;
      server_name domain.com www.domain.com;
     ##  redirect https www to https non-www
          if ($host = 'www.domain.com' ) {
             return 302 https://domain.com$request_uri;
          }
      ssl_dhparam /usr/local/nginx/conf/ssl/domain.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/domain.com/ssl-unified.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/domain.com/domain.com.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # dual cert supported ssl ciphers
      ssl_ciphers     EECDH+CHACHA20-draft:EECDH+CHACHA20:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
      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;
      #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;
     ssl_trusted_certificate /usr/local/nginx/conf/ssl/domain.com/ssl-trusted.crt;
    
    # 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/domain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/domain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf;
      root /home/nginx/domains/domain.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/domain.com/wpcacheenabler_domain.com.conf;
      #include /usr/local/nginx/conf/wpincludes/domain.com/wpsupercache_domain.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/domain.com/rediscache_domain.com.conf;
    include /usr/local/nginx/conf/php.conf;
    
    
      location / {
      #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/domain.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;
    include /usr/local/nginx/conf/php.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;
    include /usr/local/nginx/conf/php.conf;
    
    }
    
      include /usr/local/nginx/conf/wpincludes/domain.com/wpsecure_domain.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/php.conf;
    
     
      include /usr/local/nginx/conf/wpffpc.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      #include /usr/local/nginx/conf/php.conf;
      #include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
      include /usr/local/nginx/conf/sitemap-config.conf;
    }
    


    domain.com.conf-disabled
    Since I am using HTTPS as default I don't think it needs to be posted here.
     
  9. eva2000

    eva2000 Administrator Staff Member

    36,050
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    10:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Excellent (y)
    not really, trial and error and reading pagespeed admin console's message history log is usually how I figure what to include/exclude from nginx pagespeed optimisation
     
..