Welcome to Centmin Mod Community
Become a Member

Wordpress Reset wp-login.php HTTP Authentication Password?

Discussion in 'Blogs & CMS usage' started by lostincable, May 30, 2020.

  1. lostincable

    lostincable New Member

    Feb 17, 2018
    Local Time:
    2:24 AM
    Hi there

    During a WordPress install I didn't password protect the directory as offered by the installer.

    Is there an easy command to password protect my site now it's already setup?

    I can obviously use htpasswd but just checking if something is available in centminmod to do this.
  2. Jon Snow

    Jon Snow Active Member

    Jun 30, 2017
    Local Time:
    1:24 PM
    Nginx 1.13.9
    MariaDB 10.1.31
    FAQ item 43

    Don't think there's another way.
  3. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    2:24 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    FAQ item 43 is general way to do it and same outlined below just specific to centmin.sh menu option 22 created Wordpress ites.

    When you run centmin.sh menu option 22 to create a Nginx based Wordpress site, there will be at end of the process all the relevant login details provided. If you answered yes to HTTP password protect login wp-login.php then those user/password details will be at end of centmin.sh menu option 22 run. As with all centmin.sh menu options logs are automatically saved at /root/centminlogs. So at end of centmin.sh menu option 22 run it will tell you were the log was saved.

    example at /root/centminlogs/centminmod_123.09beta01.b203_120719-221749_wordpress_addvhost.log
    Code (Text):
    vhost for domain.com wordpress setup successfully
    domain.com setup info log saved at:

    You can search for all the logs via grep filter below
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep '_wordpress_addvhost.log'

    or find command
    Code (Text):
    find /root/centminlogs/ -type f -name "*_wordpress_addvhost.log"

    example output
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep '_wordpress_addvhost.log'
    -rw-r--r--   1 root root  21K Feb  3 22:29 centminmod_123.09beta01.b421_030220-222801_wordpress_addvhost.log
    -rw-r--r--   1 root root  26K Apr 15 21:26 centminmod_123.09beta01.b490_150420-211636_wordpress_addvhost.log

    Code (Text):
    find /root/centminlogs/ -type f -name "*_wordpress_addvhost.log"

    To reset Wordpress wp-login.php HTTP password created by centmin.sh menu option 22 wordpress auto installer, you can use htpasswd.sh script
    Code (Text):
    /usr/local/nginx/conf/htpasswd.sh create /home/nginx/domains/$vhostname/htpasswd_wplogin USERNAME PASSWORD

    where, you change USERNAME to your desired username and PASSWORD to your password and change yourdomain.com to your wordpress site's domain name

    then restart nginx
    Code (Text):

    Or if you want to disable http password protection comment out both these lines
    Code (Text):
       auth_basic "Private";
       auth_basic_user_file /home/nginx/domains/demodomain.com/htpasswd_wplogin;

    Code (Text):
       #auth_basic "Private";
       #auth_basic_user_file /home/nginx/domains/demodomain.com/htpasswd_wplogin;

    then restart nginx