Hello everyone,

Today, I setup a new server using Debian and WordOps for my new website, everything is working smooth and I really like the Debian server, I think it's better than Ubuntu.

Here is how I set password to protect wp-admin folder. I searched on the forum and there isn't a tutorial so I write this.

  1. sudo apt-get install apache2-utils - Install the utilities to do the tasks

  2. sudo mkdir /home/password - Create the directory where password file storage.

  3. sudo htpasswd -c /home/password/.htpasswd theusername (theusername is your username option, set any name you want). - Create the username and password.

  4. Enter your password

  5. sudo nano /var/www/yoursite.com/conf/nginx/protectadmin.conf - Create the config file for your domain.

  6. Copy the config content below into the file and save it.

    location /wp-admin {
    location ~ /wp-admin/admin-ajax.php$ {
    include fastcgi_params;
    fastcgi_pass php74;
    }
    location ~* /wp-admin/.*.php$ {
    include fastcgi_params;
    fastcgi_pass php74;

    satisfy any;
    allow 127.0.0.1;
    deny all;
    auth_basic "Authorization Required";
    auth_basic_user_file /home/password/.htpasswd;
    }
    }

If you're using php 7.3, you should change php74 to php73 from the config file above.

  1. sudo wo stack restart --nginx

That's all. Please correct me if you found any mistake.

Best regards,

Not sure why my post got marked as hidden. If you don't want my url display in the post please tell me. Anyway, I removed the url. Just want to help new member.

Hosted by VirtuBox