In this Article , we will setup how to Enable Basic Authentication to limit access on your specific web pages.

Step 1:For Example Set Basic Authentication setting under the directory [/var/www/html/linuxscriptshub].

vi /etc/httpd/conf.d/auth_basic.conf

# create new
/var/www/html/linuxscriptshub>
AuthType Basic
AuthName “Basic Authentication”
AuthUserFile /etc/httpd/conf/.htpasswd
require valid-user

Step 2: Add a user : create a new file with “-c” ( add the “-c” option only for the initial registration )

htpasswd -c /etc/httpd/conf/.htpasswd zeckson

New password: # set password
Re-type new password: # confirm
Adding password for user zeckson

Step 3: Restart Service & Create a test page

systemctl restart httpd
mkdir /var/www/html/linuxscriptshub 
vi /var/www/html/linuxscriptshub/index.html

#create a test page

Test Page for Basic Auth


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *