当前位置: 技术问答>linux和unix
.htaccess系统认证问题,弹不出登录框
来源: 互联网 发布时间:2015-09-27
本文导语: 目录为html .htaccess里的内容是这样的 AuthType Basic AuthName "请输入管理密码:" AuthUserFile ./data/authuser require user lybase 然后在data目录里放认证文件 浏览http://www.*.net/html 没有出现登录的提示框,出现错误提示我错在哪...
目录为html
.htaccess里的内容是这样的
AuthType Basic
AuthName "请输入管理密码:"
AuthUserFile ./data/authuser
require user lybase
然后在data目录里放认证文件
浏览http://www.*.net/html
没有出现登录的提示框,出现错误提示我错在哪里了??
Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
Apache/2.0.40 Server at adsl.lybase.net Port 80
分不够是可以再加地
.htaccess里的内容是这样的
AuthType Basic
AuthName "请输入管理密码:"
AuthUserFile ./data/authuser
require user lybase
然后在data目录里放认证文件
浏览http://www.*.net/html
没有出现登录的提示框,出现错误提示我错在哪里了??
Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
Apache/2.0.40 Server at adsl.lybase.net Port 80
分不够是可以再加地
|
实现步骤:
使用htpasswd建立用户文件
htpasswd –c /home/httpd/secr/.htpasswd super
此程序会询问用户“super”的口令,你输入“fill-06”,两次生效。
建立.htaccess文件
用vi在/home/httpd/html/backup/目录下建立一个文件.htaccess,写入
以下几行:
AuthName My Friend Only (注:这个名字是任取的)
AuthType Basic
AuthUserFile /home/httpd/secr/.htpasswd
require user super
这样就完成了设置工作,你可以试一试效果了。
完成以后,发现没有想象中的效果*(无法实现密码验证)
解决方法:
用VI编辑HTTPD.CONF
找到 DocumentRoot /home/httpd/html
添加AccessFileName .htaccess
将AllowOverride None改为AllowOverride All
将.HTPASSWD 和.htaccess的权限设置为755,确保Apache用户有读的权限.
使用htpasswd建立用户文件
htpasswd –c /home/httpd/secr/.htpasswd super
此程序会询问用户“super”的口令,你输入“fill-06”,两次生效。
建立.htaccess文件
用vi在/home/httpd/html/backup/目录下建立一个文件.htaccess,写入
以下几行:
AuthName My Friend Only (注:这个名字是任取的)
AuthType Basic
AuthUserFile /home/httpd/secr/.htpasswd
require user super
这样就完成了设置工作,你可以试一试效果了。
完成以后,发现没有想象中的效果*(无法实现密码验证)
解决方法:
用VI编辑HTTPD.CONF
找到 DocumentRoot /home/httpd/html
添加AccessFileName .htaccess
将AllowOverride None改为AllowOverride All
将.HTPASSWD 和.htaccess的权限设置为755,确保Apache用户有读的权限.
|
还有在apache的配置文件里面httpd.conf中配置一下才行的.
|
正常!
密码就没有加嘛
密码就没有加嘛
|
gz
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。