Learn about Centmin Mod LEMP Stack today
Register Now

How to Install Wordpress Multiple times in sub-directories

Discussion in 'Blogs & CMS usage' started by Fernando, Jul 19, 2018.

Tags:
  1. Fernando

    Fernando Member

    44
    8
    8
    Jul 21, 2017
    Ratings:
    +12
    Local Time:
    3:56 AM
    1.13.3
    10.1.25
    Hi,

    I'm not sure how to Install Wordpress using option 22 multiple times for the same domain.

    My goal is to have the following:
    domain.com/cr
    domain.com/hn
    domain.com/pa
    etc

    So I would like to have 3 different installations of Wordpress. I'm not sure how I can acomplish this since I get:

    Code:
    -------------------------------------------------------------
    vhost for domain.com already exists
    /home/nginx/domains/domain.com already exists
    I can only do it in subdomains like
    cr.domain.com
    pa.domain.com, etc

    Thank you!
    Best Regards
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    centmin.sh menu option 22 only supports single site wordpress or subdomain site wordpress installs. It can't do multi site or multiple subdirectory installs for wordpress.

    you can technically do subdomain installs first and then manually move then to subdirectories as outlined at Wordpress - centmin.sh menu option 22 - How to switch Wordpress to subdirectory

    edit: though in theory i could extend centmin.sh menu option 22 to eventually support subdirectory installs in existing setup nginx vhosts extending this subdirectory mode Wordpress - centmin.sh menu option 22 - How to switch Wordpress to subdirectory
     
    • Winner Winner x 1
  3. Fernando

    Fernando Member

    44
    8
    8
    Jul 21, 2017
    Ratings:
    +12
    Local Time:
    3:56 AM
    1.13.3
    10.1.25
  4. Fernando

    Fernando Member

    44
    8
    8
    Jul 21, 2017
    Ratings:
    +12
    Local Time:
    3:56 AM
    1.13.3
    10.1.25
    Sorry for the delay, apparentely, it works, not sure if I need to modify something else. I'm using redis so I just wanted to check if everything is fine with these steps:

    1. First I installed www.buscaquien.com/cr (option 22 / Redis)
    2. Then I installed www.pn.buscaquien.com (option 22 / Redis)
    3. Then in home/nginx/domains/buscaquien.com/public , I created the folder pn
    4. Moved everything from /home/nginx/domains/pn.buscaquien.com/public to /nginx/domains/buscaquien.com/public/pn
    5. Modified permissions to nginx:nginx for /nginx/domains/buscaquien.com/public/pn/*
    6. Modified vhost as follows: (this is my testing domain and trying to keep everything simple as possible for now)

    Code:
    cat buscaquien.com.conf
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name buscaquien.com;
    #            return 301 $scheme://www.buscaquien.com$request_uri;
    #       }
    
    server {
    
      server_name buscaquien.com www.buscaquien.com;
    
    # 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;
    
      #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";
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/buscaquien.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/buscaquien.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/buscaquien.com/autoprotect-buscaquien.com.conf;
      root /home/nginx/domains/buscaquien.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/buscaquien.com/wpcacheenabler_buscaquien.com.conf;
      #include /usr/local/nginx/conf/wpincludes/buscaquien.com/wpsupercache_buscaquien.com.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/wpincludes/buscaquien.com/rediscache_buscaquien.com.conf;
    
      location /cr {
      include /usr/local/nginx/conf/503include-only.conf;
      include /usr/local/nginx/conf/wpincludes/buscaquien.com/wpsecure_buscaquien.com.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/ /cr/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/ /cr/index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /cr/index.php?$args;
    
      }
    
      location /pn {
      include /usr/local/nginx/conf/503include-only.conf;
      include /usr/local/nginx/conf/wpincludes/buscaquien.com/wpsecure_buscaquien.com.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/ /cr/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/ /cr/index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /cr/index.php?$args;
    
      }
    
    
    location ~* /cr/(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        #auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/buscaquien.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 ~* /pn/(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        #auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/buscaquien.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 ~* /cr/(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 ~* /pn/(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 ~* /cr/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 ~* /pn/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 ~* /cr/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;
    }
    
    location ~* /pn/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/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-buscaquien.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;
    }
    
    7. ngxrestart
    8. Modified wp_updater_pn.buscaquien.com.sh as follows:

    Code:
    cat wp_updater_pn.buscaquien.com.sh
    #!/bin/bash
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/bin
    EMAIL=f***@gmail.com
    EMAILFROM=f***@gmail.com
    DT=$(date +"%d%m%y-%H%M%S")
    
    {
    cd /home/nginx/domains/buscaquien.com/public/pn
    echo "/home/nginx/domains/buscaquien.com/public/pn"
    #/usr/bin/wp cli update --allow-root
    echo "update wp-cli"
    rm -rf /usr/bin/wp
    wget -4cnv --no-check-certificate https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp --tries=3
    chmod 0700 /usr/bin/wp
    /usr/bin/wp --info --allow-root
    /usr/bin/wp plugin status --allow-root
    /usr/bin/wp plugin update --all --allow-root | tee .wpcli-status
    #/usr/bin/wp core check-update --allow-root
    #/usr/bin/wp core update --allow-root
    #/usr/bin/wp core update-db --allow-root
    #/usr/bin/wp core update --allow-root
    chown -R nginx:nginx /home/nginx/domains/buscaquien.com/public/pn
    if [[ -f .wpcli-status && ! "$(grep -w 'Plugin already updated' .wpcli-status)" ]]; then
      exec 99>/tmp/wp_updater_phpfpm.lock
      if flock -n -x 99; then
        # only do nginx + php-fpm restarts when zend opcache caching is enabled and revalidation
        # frequency is greater than 10 seconds set by opcache.revalidate_freq php setting
        if [[ "$(php --ri "Zend Opcache" >/dev/null 2>&1; echo $?)" -eq '0' && "$(php --ri "Zend Opcache" | awk '/opcache.revalidate_freq/ {print $3}')" -gt '10' ]]; then
          /usr/bin/nprestart
        fi
      rm -rf /tmp/wp_updater_phpfpm.lock
      else
      echo "already detected running process"
      echo "skipping nprestart"
      fi
    fi
    rm -rf .wpcli-status
    } 2>&1 | tee /home/nginx/domains/buscaquien.com/log/wp_updater-${DT}.log
    cat -v /home/nginx/domains/buscaquien.com/log/wp_updater-${DT}.log | /usr/bin/tr -cd '\11\12\15\40-\176' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | dos2unix | mail -r $EMAILFROM -s "Wordpress WP-CLI Auto Update $(date)" $EMAIL
    #rm -rf /home/nginx/domains/pn.buscaquien.com/log/wp_updater-${DT}.log
    9. Removed from cron:
    Code:
    #*/15 * * * * sleep 100s ; wget -O - -q -t 1 http://pn.buscaquien.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    Since I already have:
    Code:
    #*/15 * * * * sleep 258s ; wget -O - -q -t 1 http://buscaquien.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    10. If using redis then just use different values for:
    Code:
    define('WP_REDIS_DATABASE', 1);
    then for /pn in wp-config.php
    Code:
    define('WP_REDIS_DATABASE', 2);
    I think this works fine, the only missing thing I guess will be if using let's encrypt. But I believe nothing needs to be done since buscaquien.com/* is covered?

    Is there anything else that needs to be changed?
    Thank you once again for your great help!

    Best Regards
     
    • Informative Informative x 1
  5. Fernando

    Fernando Member

    44
    8
    8
    Jul 21, 2017
    Ratings:
    +12
    Local Time:
    3:56 AM
    1.13.3
    10.1.25
    Between step #4 and #5
    I ran:
    Code:
    wp search-replace 'http://pn.buscaquien.com' 'http://buscaquien.com/pn' --skip-columns=guid --allow-root
     
    • Like Like x 1
  6. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Looks good to me..
    yup letsencrypt will cover entire https:// version of your domain

    might want to remove your email address from public display of wp updater script code
     
    • Like Like x 1
  7. Fernando

    Fernando Member

    44
    8
    8
    Jul 21, 2017
    Ratings:
    +12
    Local Time:
    3:56 AM
    1.13.3
    10.1.25
    Hi,

    Thank you :) I really appreciate your help!
    Best Regards
     
    • Like Like x 1
  8. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    This is actually a great step by step guide that I used recently to move a subdomain.site.com with redis to a site1.com/blog.

    @eva2000 you might be interested in this as I'm trying to run XF 2 in root and wordpress in /blog both with redis. It actually worked for a day :)

    Having said that redis suddenly stopped caching the /blog site. The only things changed was upgrading to nginx 1.15.2 and doing a few yum updates that I never really paid attention to. Redis does work with other standard option 22 sites but stopped on this one.

    Trying to figure out what's changed and how to debug redis.

    Below is the edited ssl.conf file, I've tried various variations without success now:

    Code:
    #x# HTTPS-DEFAULT
     server {
    
       server_name mysiteforums.com www.mysiteforums.com;
       return 302 https://mysiteforums.com$request_uri;
       include /usr/local/nginx/conf/staticfiles.conf;
     }
    
    #       listen   80;
    #       server_name mysiteforums.com www.mysiteforums.com;
    #       return 302 https://$server_name$request_uri;
    
    server {
      listen 443 ssl http2;
      server_name mysiteforums.com www.mysiteforums.com;
    
      include /usr/local/nginx/conf/ssl/mysiteforums.com/mysiteforums.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/mysiteforums.com/origin.crt;
      #ssl_verify_client on;
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
      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;
      #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/mysiteforums.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mysiteforums.com/log/error.log;
    
      #include /usr/local/nginx/conf/autoprotect/mysiteforums.com/autoprotect-mysiteforums.com.conf;
      root /home/nginx/domains/mysiteforums.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;
    
      location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$uri&$args;
            #include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
    
      }
    
    location /internal_data/ {
            internal;
            allow 127.0.0.1;
            allow 99.250.61.143;
            deny all;
            }
    
            location /library/ {
            internal;
            allow 127.0.0.1;
            allow 99.99.99.99;
            deny all;
            }
    
    location /admin.php {
    #             auth_basic "Private";
     #            auth_basic_user_file /home/nginx/domains/mysiteforums.com/htpasswd_admin_php;
                    include /usr/local/nginx/conf/php.conf;
     #               allow 127.0.0.1;
     #               allow 99.99.99.99;
     #               deny all;
            }
    
            location /install/ {
                 auth_basic "Private";
                 auth_basic_user_file /home/nginx/domains/mysiteforums.com/htpasswd_admin_php;
                    include /usr/local/nginx/conf/php.conf;
                    allow 127.0.0.1;
                    allow 99.99.99.99;
                    deny all;
            }
    
    #Nik Add Wordpress
      include /usr/local/nginx/conf/wpincludes/blog.mysiteforums.com/rediscache_home.mysiteforums.com.conf;
    
      location /blog {
      include /usr/local/nginx/conf/503include-only.conf;
    #include /usr/local/nginx/conf/php-rediscache.conf;
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /blog/index.php?$args;
    #include /usr/local/nginx/conf/php-rediscache.conf;
      }
    
    location ~* /blog/(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        #auth_basic "Private";
        #auth_basic_user_file /home/nginx/domains/home.mysiteforums.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 ~* /blog/(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 ~* /blog/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 ~* /blog/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/php-rediscache.conf;
    
    #NIK Original
      include /usr/local/nginx/conf/pre-staticfiles-local-mysiteforums.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.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;
    }
    
    
     
    Last edited: Aug 9, 2018
  9. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    your /blog location context isn't using php-redis.php include file
    Code (Text):
      location /blog {
      include /usr/local/nginx/conf/503include-only.conf;
    #include /usr/local/nginx/conf/php-rediscache.conf;
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /blog/index.php?$args;
    #include /usr/local/nginx/conf/php-rediscache.conf;
      }
    

    should become
    Code (Text):
      location /blog {
      include /usr/local/nginx/conf/503include-only.conf;
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      try_files $uri $uri/ /blog/index.php?$args;
      include /usr/local/nginx/conf/php-rediscache.conf;
      }
    
     
  10. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    Sorry it was before and still stopped working. I had commented it out to experiment a bit.
     
  11. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    how are you testing if redis works on /blog site ?
     
  12. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    I'm checking redis DB/keystore for keys to /blog site. There were none. Funnily enough I just saw one for /blog, delayed by almost 2 hours. I'm using phpredisadmin to monitor (occasionally redis-cli). I'm testing by coming into /blog as unauthenticated/guest user.

    Yesterday it was working perfectly and each post/page in WP was creating entries in my redis DB for /blog. Today seems to be a different story.
     
  13. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    I'm also noticing the following headers being set for that /blog site:

    HTTP/1.1 200 OK Content-Type: text/html;
    charset=utf-8 Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Link: <https://myforums.com/blog/wp-json/>;
    rel="REST API Handbook | WordPress Developer Resources"
    X-Frame-Options: SAMEORIGIN
    X-Content-Type-Options: nosniff
    Last-Modified: Wed, 08 Aug 2018 18:29:12 GMT Expires: Thu, 19 Nov 1981 08:52:00
    Cache-Control: private, no-cache, max-age=0
     
  14. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    doesn't look like any redis nginx level cache headers exist - is the /blog wp install's nginx-helper plugin configured properly ? try saving those settings again ?
    strange then, tried restarting Redis server + nginx + php-fpm services ?
     
  15. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    I've rebooted the whole server and manually cleared out redis with a flushall. It's like it doesn't like me any more. The plugin is configured correctly and I do see some sporadic entries now as other users hit those links (personally cannot get them to populate).

    I don't need to install any other redis plugin or script in WP right? Like the Redis Object Cache plugin or something?
     
  16. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    nothing else, if you did have redis object cache installed it could mess with saving wp admin settings so i'd uninstall redis object cache plugin if you did have it.
     
  17. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    No I did not.

    Where are these cache-control headers being set I wonder?

    It looks like I'm now getting redis populated (from other users I suspect). I'm out of ideas on this one lol but I do see keys in the DB for blog. Now just need to fix cache control headers.
     
  18. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    7:56 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Try enabling nginx debug mode for your ISP ip only and see if logs reveal more.

    To enable, add to persistent config file /etc/centminmod/custom_config.inc the variable NGINX_DEBUG=y and recompile Nginx via centmin.sh menu option 4 and then setting error_log in nginx vhosts to debug as outlined at nginx.org/en/docs/debugging_log.html & wiki.nginx.org/Debugging.

    You do not want to leave Nginx debug mode running forever, so after debugging, set NGINX_DEBUG=n or remove the variable from the persistent config file /etc/centminmod/custom_config.inc and recompile Nginx again via centmin.sh menu option 4 and remove error_log debugging mode to disable Nginx debug mode again.

    To update your Centmin Mod builds code for Nginx debug mode support if you do not have a NGINX_DEBUG variable in centmin.sh, follow instructions at centminmod.com/upgrade.html and respective version threads below:
    Centmin Mod is provided as is, but you can try debugging mode for Nginx for further troubleshooting if you have problems with Nginx (i.e. segfaults / signal 11 issues) as outlined at nginx.org/en/docs/debugging_log.html & wiki.nginx.org/Debugging.
     
  19. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    Thanks, I'll give this a go as a last resort.

    Do you know where you might be setting the Cache-Control headers? Cache-Control: no-cache, must-revalidate, max-age=0 for example...

    As per my updated post above it looks like 'other' users are now populating redis somehow but cache-control headers don't look right.
     
  20. Nik

    Nik Member

    31
    1
    8
    Dec 7, 2015
    Ratings:
    +4
    Local Time:
    5:56 AM
    So update on this, I'm getting very inconsistent caching with redis, it only appears to be setting cache for WP categories and root (not posts). Looking at my redis DB keys as well as headers, keys are not set for posts and x-cache is consistently a MISS obviously. Not sure what's going wrong there as other redis WP sites are working correctly so likely a config issue on my end @Fernando if you are still watching this thread and would not mind sharing your config files (privately is fine) I can do a quick compare to see if it's anything obvious I've missed.

    Anyway, thanks @eva2000
     
    Last edited: Aug 10, 2018
    • Informative Informative x 1
..