產生帳號密碼檔
[email protected]:~$ touch pwd
[email protected]:~$ htpasswd -b ~/pwd user password
Adding password for user user
[email protected]:~$ cat pwd
user:$apr1$22B**********RdsQ/64LLBCoInbal/
[email protected]:~$
編輯.htaccess檔案
AuthName "輸入帳號密碼" #出現在提示方塊中的文字
AuthType Basic
AuthUserFile "/home/user/pwd" #密碼保存的地方
Require valid-user
example: https://panel.csie.one/
source: Apache內建基本驗證機制 快速啟用mod_auth網頁認證