Want more timely Centmin Mod News Updates?
Become a Member

Unable to Access Wordpress

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

Tags:
  1. Fernando

    Fernando Member

    71
    12
    8
    Jul 21, 2017
    Ratings:
    +25
    Local Time:
    1:15 PM
    1.13.3
    10.1.25
    Hi, I'm out of ideas, my Wordpress has wp-login.php protected, I've been working all day long I logged out at some point today and tried to login again and I'm no longer able to get in.

    I'm getting
    401 Authorization Required
    nginx

    Instead of the regular login screen to login into Wordpress.

    Things that I have tried:
    1. Reset htpasswd_wplogin by deleting the file and re-created
    2. /usr/local/nginx/conf/htpasswd.sh create /home/nginx/domains/loquevendes.com/htpasswd_wplogin XXXXXX XXXXXX
    3. nprestart

    It didn't work, so I try to delete it the file htpasswd_wplogin and nprestart but still I'm getting the 401.

    - Wordpress installed using option 22 / Using Redis Object Cache
    - Also using Cloudflare

    I also tried the following:
    - redis-cli flushall
    - wp nginx-helper purge-all
    - nprestart
    - Disable Cloudflare (Development Mode to avoid any caching)
    - Clear browser cache
    - Use incognito mode

    Still I'm getting the 401. The only visible change is that Wordpress was automatically upgraded to 4.9.7 today

    Code:
    curl -I "https://www.loquevendes.com/wp-login.php?$(date +%s)" -k
    HTTP/1.1 401 Unauthorized
    Date: Thu, 05 Jul 2018 23:20:04 GMT
    Content-Type: text/html; charset=utf-8
    Connection: keep-alive
    Set-Cookie: __cfduid=d8c8ff645df7821cb8474073d8ea443231530832804; expires=Fri, 05-Jul-19 23:20:04 GMT; path=/; domain=.loquevendes.com; HttpOnly; Secure
    WWW-Authenticate: Basic realm="Private"
    X-Powered-By: centminmod
    X-Cache: BYPASS
    X-Cache-2: BYPASS
    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: 435d8f62fc419b68-DFW
    The above should work as there's no htpasswd_wplogin and nprestart has been performed.

    Code:
    ll /home/nginx/domains/loquevendes.com/htpasswd_wplogin
    ls: cannot access /home/nginx/domains/loquevendes.com/htpasswd_wplogin: No such file or directory
    Thank you for your help! :)
     
  2. eva2000

    eva2000 Administrator Staff Member

    45,468
    10,319
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,005
    Local Time:
    5:15 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    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 may have both non-https and https nginx vhost files /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf. Make sure you're editing the right nginx vhost file for your site. i.e. you seem to have https site so /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf is the nginx vhost where newdomain.com = your domain name

    Did you enable ip protection and only allow specific IP address, youre ISP IP address may have changed so no longer whitelisted.
     
  3. Fernando

    Fernando Member

    71
    12
    8
    Jul 21, 2017
    Ratings:
    +25
    Local Time:
    1:15 PM
    1.13.3
    10.1.25
    Hi,

    Thank you for your help and sorry for the delay. I totally forgot to comment the htpasswd_wplogin in my /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf file.

    So these are the steps that I did:
    - Removed /home/nginx/domains/loquevendes.com/htpasswd_wplogin
    - Comment htpasswd_wplogin in /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    - nprestart / nginx restart
    - Login through wp-login.php
    - Re-configure nginx-helper
    - Purge entire Cache
    - Logout from Wordpress
    - Re-enable htpasswd_wplogin
    - Un-comment again htpasswd_wplogin in /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    - Run again /usr/local/nginx/conf/htpasswd.sh create /home/nginx/domains/loquevendes.com/htpasswd_wplogin YOURUSERNAME YOURPASSWORD
    - nprestart / nginx restart

    Now I got access again using the protected URL.

    I'm not sure what's going on but sometimes I see that nginx-helper doesn't clear the cache properly and I think it was causing the issue. When I got access again to Wordpress I noticed that the configuration was missing so I guess the command wp nginx-helper purge-all was not doing anything, just a possibility...but I'm not sure. So far it's difficult to work with nginx-helper since it doesn't to work all the time.

    Thank you again for your great help and for such a great tool! It's the best!
    Best Regards
     
  4. eva2000

    eva2000 Administrator Staff Member

    45,468
    10,319
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,005
    Local Time:
    5:15 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    how did you reconfigure nginx-helper specifically - it is checked on redis config ? also remove redis object cache wp plugin, that is known to sometimes cause issues with changing wp admin settings and usually you want to flush redis cache after making wp admin setting changes if you use redis object cache wp plugin
     
  5. Fernando

    Fernando Member

    71
    12
    8
    Jul 21, 2017
    Ratings:
    +25
    Local Time:
    1:15 PM
    1.13.3
    10.1.25
    Hi,

    Please see below:
    how did you reconfigure nginx-helper specifically - it is checked on redis config ?
    - When I get into Wordpress the Enable Purge was unchecked, so neither nginx Fastcgi cache / Redis Option was checked also since the purge was unchecked.

    also remove redis object cache wp plugin
    - Yes :) I always disable the plugin when doing any changes and just before leaving Wordpress admin I re-enable it.

    I have another question if you don't mind, do you believe there will be any problem of using Woocommerce and Nginx-Helper + Redis Object Cache? I believe that I won't have any problem with Object Cache however, I haven't test yet but I think that Nginx-Helper won't work.

    I know you suggest a different Cache option when using Wordpres + Woocommerce but I really want to use Redis Object Cache, the performance is much better than any other plugin method in my opinion.

    Thank you!
     
  6. eva2000

    eva2000 Administrator Staff Member

    45,468
    10,319
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,005
    Local Time:
    5:15 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    redis object cache is for database connections, if you have full page caching in place most of guests won't hit php-fpm or database anyway.

    nginx-helper is always needed to be configured if using redis nginx level wp caching otherwise purges won't happen on redis nginx level (nothing to do with redis object cache wp plugin)

    centmin mod menu option 22 wp installer redis nginx level caching and keycdn cacher enabler in centmin mod 123.09beta01 have additional exclusion rules to make it work better with woocommerce out of the box - not perfect but better that folks manually installing wp caching plugins on non-centminmod servers.
     
  7. Fernando

    Fernando Member

    71
    12
    8
    Jul 21, 2017
    Ratings:
    +25
    Local Time:
    1:15 PM
    1.13.3
    10.1.25
    Hi,

    Thank you for your great help :)
    Best Regards