apache 给个人网站设置密码
1. 在服务器配置apache 用户名密码
[root@test01 home]# htpasswd -c /etc/httpd/passwd test1 New password: Re-type new password: Adding password for user usertest1
2.配置apache,添加如下内容,目录根据各自需要进行配置
[root@test01 home]# vim /etc/httpd/conf/httpd.conf <Directory "/var/www/html/fr/*"> AllowOverride all authuserfile "/etc/httpd/passwd" authname "My privately website" authtype basic require user test1 </Directory>
3. 重启 apache
systemctl restart httpd