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

  

相关文章:

  • 2022-12-23
  • 2021-08-22
  • 2021-11-24
  • 2021-06-20
  • 2021-07-12
  • 2022-12-23
  • 2021-06-05
  • 2021-12-13
猜你喜欢
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-05-01
  • 2022-12-23
相关资源
相似解决方案