首页 > Web开发 > 详细

apache 给个人网站设置密码

时间:2021-03-04 19:00:16      阅读:32      评论:0      收藏:0      [点我收藏+]

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

  

apache 给个人网站设置密码

原文:https://www.cnblogs.com/royfans/p/14481540.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!