Join the community today
Register Now

Wordpress Cache-Enabler Plugin Wordpress Site Nginx 403 Forbidden HELP Please

Discussion in 'Blogs & CMS usage' started by skringjer, Jun 30, 2019.

  1. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:06 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    Hello everyone @eva2000 , i just shifted one of my sites to Centminmod, its a wordpress site, i used Option 22 to setup wordpress with redis cache

    Then i removed all content from public folder except the plugins and imported my old wordpress in it, created a Database and linked it with the site but i am getting error

    Refused to connect, and this is because of nginx not restarting, here is nginx -t value


    Code:
    nginx: [emerg] duplicate location "/" in /usr/local/nginx/conf/conf.d/mydomainhere.com.conf:45
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    Is someone could please help fasts, its live site

    here is my nginx conf file for the website

    Code:
    # 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 mydomainhere.com;
    #            return 301 $scheme://www.mydomainhere.com$request_uri;
    #       }
    
    server {
     
      server_name mydomainhere.com www.mydomainhere.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/mydomainhere.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mydomainhere.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/mydomainhere.com/autoprotect-mydomainhere.com.conf;
      root /home/nginx/domains/mydomainhere.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/mydomainhere.com/wpcacheenabler_mydomainhere.com.conf;
      #include /usr/local/nginx/conf/wpincludes/mydomainhere.com/wpsupercache_mydomainhere.com.conf;
      # https://community.centminmod.com/posts/18828/
      include /usr/local/nginx/conf/wpincludes/mydomainhere.com/rediscache_mydomainhere.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; 
    
      # 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/mydomainhere.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/mydomainhere.com/wpsecure_mydomainhere.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/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
     
  2. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:06 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    @eva2000 Okay so i have an update, I completely removed the domain, went again to option 22 and this time i selected and instead of Redis option i choose Super Cache one, And everything worked fine, got the SSL and site is live.

    From what i have read Redis at nginx level is better, Eva can you suggest from here on what should i do?

    I also looked into Nginx PageSpeed modules and i am intending to enable them and also the PHP PGO, can you please link here server side optimizations and also wordpress. Thanks alot.

    And should i continue with the Super Cache wordpress setup or switch back to redis?
     
    Last edited: Jul 1, 2019
  3. eva2000

    eva2000 Administrator Staff Member

    55,381
    12,255
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,835
    Local Time:
    11:06 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    all instructions are linked to at Insight Guide - How to boost Centmin Mod LEMP stack performance

    In context of Wordpress caching for centmin.sh menu option 22 wordpress auto installer for Centmin Mod 123.09beta01 and newer, you have 3 offered wordpress caching options:
    1. Redis Nginx Level Caching - centmin.sh menu option 22 will auto install redis if not detected if you choose this in centmin.sh menu option 22 setup. Otherwise, need to install redis yourself. Best combined with Autoptimize WP plugin
    2. KeyCDN Cache Enabler for full page static html caching (safest choice for balance of performance and reliability). Best combined with Autoptimize WP plugin
    3. WP Super Cache for full page static html caching. Best combined with Autoptimize WP plugin
    1. redis caching at nginx level can be fastest but needs fine tuning and deep understanding of your web app and it's plugins to get right i.e. woocommerce etc. So can be problematic too. Most caching is are for guest caching only.

    2. keycdn cache enabler wp plugin - better version of wp super cache for full page static caching of wordpress. Least problematic and closest to set and forget with maybe some tuning needed depending on wp plugins and site configuration. Config is for guest caching only.

    And regardless of caching method, having right server(s) hardware and configuration and LEMP stack and system TCP level configurations to handle the traffic is a must otherwise regardless of caching used, it won't scale. So you would want non-OpenVZ based VPS like KVM or dedicated. Choosing OpenVZ VPS will limit your scalability.

    FYI, all caching methods = generally higher memory consumption and sometimes higher cache related cpu consumption. The goal of caching in context of wordpress is usually to lessen the load placed on php/php-fpm as that is the weakest part of any LEMP/LAMP setup in terms of scalability. So sometimes caching isn't necessary faster just scales better in high concurrent traffic environments.

    You can see centmin.sh menu option 22 wordpress installed demo and benchmarks on my Wordpress7 demo site.
     
  4. skringjer

    skringjer NoobMaster69

    208
    26
    28
    Apr 21, 2019
    Ratings:
    +43
    Local Time:
    6:06 AM
    Nginx 1.21.6
    MariaDB 10.3.x
    Thank you, i am looking into the optimizations and will try to understand them first.

    Since i moved to Centmin i am getting again and again this error Screenshot i tried deleting this file multiple times and the error goes and after some while it comes back, i googled and found some guys facing this issue due to Permissions, i set the correct permissions to WP-content but not luck

    Uninstalled the plugin and reinstalled but no luck, do you have any idea whats causing this issue?

    Checked my wp-config and i have define('WP_CACHE', true);
     
  5. eva2000

    eva2000 Administrator Staff Member

    55,381
    12,255
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,835
    Local Time:
    11:06 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    what permissions did you set ? from Getting started guide step 2 Getting Started Guide - CentminMod.com LEMP Nginx web stack for CentOS