How to protect a web folder using HTTP Basic Authentication with Apache2

Run the following to create a password file and enter your password

htpasswd -c /etc/httpd/passwd/myverysecrepasswords admin

-c flag means create a new file

Edit the following accordingly your needs and append into your httpd.conf file

<Directory "/var/www/html/mysecure">
AuthType Basic
AuthName "Protected Files"
AuthBasicProvider file
AuthUserFile /etc/httpd/passwd/myverysecrepasswords
Require user admin


Common paths where httpd.conf usually stored:



Similar Posts:

Leave a Reply

Your email address will not be published.