最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Apache如何增加.htaccess文件增加用户认证
时间:2022-07-02 10:43:30 编辑:袖梨 来源:一聚教程网
首先用htpasswd创建一个密码文件:比如文件名叫做my.passwd
/home/apache/bin/htpasswd -c -b my.passwd myusername mypassword
如果增加帐号:
/home/apache/bin/htpasswd -b my.passwd anotherusername anotherpassword
将my.passwd上传到一个非发布路径下。
比如你的物理WEB根目录的上一级
/home/apache/conf/my.passwd
创建 .htaccess
AuthName "My Authorization Directory"
AuthType Basic
AuthUserFile /home/apache/conf/my.passwd
Require valid-user
将这个文件上传到你需要进行用户认证的目录:
/home/apache/htdocs/admin/.htaccess
这样这个目录的访问就需要认证了。
相关文章
- 有哪些收号平台 04-28
- 红色沙漠火焰双手锤获取方法 04-28
- 崩坏星穹铁道丹恒腾荒何时上线 04-28
- 《The Sheep Detectives》评测 04-28
- 27年发售悬了 《刺客信条 女巫》被曝50人集体调离 04-28
- 异环别有洞天越狱方式详解-别有洞天如何逃离监狱 04-28