htaccess的不工作 - 总是错的密码 [英] htaccess doesn't work - always wrong password
问题描述
我在应受密码保护的目录中的两个文件:
I have two files in the directory which should be password protected:
- 的.htaccess
- htpasswd的
的.htaccess的内容:
Content of .htaccess:
的AuthUserFile /var/www/html/path/to/my/directory/.htpasswd
AuthUserFile /var/www/html/path/to/my/directory/.htpasswd
AuthName指令受保护的文件
AuthName "Protected Files"
与AuthType基本
AuthType Basic
要求用户管理
htpasswd的含量
Content of .htpasswd
管理:oxRHPuqwKiANY
admin:oxRHPuqwKiANY
,密码为admin,但尽管密码我尝试它永远是错的。他immediatetly密码后,再次问道。
The password is also admin, but despite of the password I try it is always wrong. He immediatetly asks again after the password.
什么是错的Linux服务器?
What is wrong with the Linux server?
推荐答案
这个问题几乎总是因为Apache无法读取的.htpasswd文件。有四个原因,首先想到的:
This problem is almost always because apache cannot read the .htpasswd file. There are four causes that come to mind:
-
它不解析路径正确...你如何创建.htaccess文件?它有Unix的行结束(而不是说在Windows中使用记事本?
it isn't parsing the path correctly... how did you create the .htaccess file? Does it have unix line endings (versus say using Notepad in Windows?
是路径是否正确?什么是下面的命令(路径更新)说明了什么? ls -l命令/var/www/html/path/to/my/directory/.htpasswd
is the path correct? What does the following command (with the path update) show? ls -l /var/www/html/path/to/my/directory/.htpasswd
不Web服务器有权访问该文件? CHMOD 644,看看是否能解决问题。
does the web server have access to the file? chmod 644 and see if that solves the problem.
它无法分析。htpasswd的文件:在这种情况下,您使用的是隐窝()加密,因此不会创建Linux上的文件,它可能是罚款看起来。某些类型的加密只能在某些平台上,如果有疑问,请尝试切换为MD5。
it can't parse the .htpasswd file: in this case, you are using the crypt() encryption so it does seem you created the file on Linux and it is probably fine. Some types of encryption only work on certain platforms, if in doubt try switching to MD5.
您可以在Apache的错误日志中找到有用的信息。
You may find helpful messages in the Apache error log.
我的钱是#3。
这篇关于htaccess的不工作 - 总是错的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!