Configure Protected Directories in Apache puzzle

Yes, you are right… thanks for reviewing @Lakshmi !

Please, i have tried, and tried and always finished the task so:

Steps

  1. Create a subfolder which is going to be protect
    e.g. mkdir -p /var/www/html/devops

  2. Create/add .htaccess file to the folder created above
    vim /var/www/html/devops/.htaccess
    AuthType Basic
    AuthName “Restricted Content”
    AuthUserFile /etc/httpd/.htpasswd
    Require valid-user

  3. Create a user/password in htpasswd
    htpasswd -c /etc/httpd/.htpasswd mark

  4. Modify the configuration file by adding below section…
    vim /etc/httpd/conf/httpd.conf
    <Directory “/var/www/html/devops”>
    AllowOverride AuthConfig

  5. Start/restart httpd
    systemctl start httpd

6.- curl -u user:passwd http://<server ip/name>:8080/devops

1 Like

logs

Forget about it, so it was success

Regards