Berikut Konfigurasinya :
[root@www ~]# vi /etc/httpd/conf.d/auth_basic.conf
----------------------------------------------------------------------------------------
<Directory /var/www/html/auth-basic>
AuthType Basic
AuthName "BasicAuthentication"
AuthUserFile /etc/httpd/conf/.htpasswd
require valid-user
</Directory>
---------------------------------------------------------------------------------------
[root@www ~]# htpasswd -c /etc/httpd/conf/.htpasswd cent
----------------------------------------------------------------------------------------
New password: # set password
Re-type new password: # confirm
Adding password for user cent
----------------------------------------------------------------------------------------
[root@www ~]# systemctl restart httpd
[root@www ~]# mkdir /var/www/html/auth-basic
[root@www ~]# vi /var/www/html/auth-basic/index.html
----------------------------------------------------------------------------------------
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Test Page for BasicAuth
</div>
---------------------------------------------------------------------------------------
Setelah itu akses situs http://ns.tkj.net/auth-basic
No comments:
Post a Comment