📜  apache 基本身份验证设置 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:39.385000             🧑  作者: Mango

代码示例1
#install apache utilis
sudo apt-get install apache2 apache2-utils
#add apache user
sudo htpasswd -c /etc/apache2/.htpasswd some_username_here

#Setup Directory permissions in Apache Config

    AuthType Basic
    AuthName "Restricted Content"
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user

#restart apache
sudo service apache2 restart