Apache基本的HTTPauthentication不起作用

尝试使用Apache设置基本的HTTP身份validation,但它不起作用。 我定期得到目录列表和文件,不需要validation。 我尝试重新启动httpd和浏览器caching。

我在/ var / log / httpd / error_log中找不到任何相关条目。

有任何想法吗?

htpasswd的:

# htpasswd -c /usr/local/share/passwords username $ ls -l /usr/local/share/passwords -rw-r--r-- 1 root root 44 Nov 23 13:29 /usr/local/share/passwords 

.htaccess

 $ cat /srv/http/test/.htaccess AuthType Basic AuthName "Some Stuff" AuthUserFile /usr/local/share/passwords Require user username 

目录:

 $ ls -la /srv/http/test/ total 16 drwxr-xr-x 2 root root 4096 Nov 23 13:27 . drwxr-xr-x 4 root root 4096 Nov 23 00:40 .. -rw-r--r-- 1 root root 96 Nov 23 13:35 .htaccess -rw-r--r-- 1 root root 14 Nov 23 00:40 page.html 

您是否允许使用htaccess文件覆盖身份validation设置? 请参阅http://httpd.apache.org/docs/current/mod/core.html#allowoverride

你有没有允许覆盖你的Apacheconfiguration? http://httpd.apache.org/docs/current/howto/htaccess.html

(对不起,旧链接,如果你使用的是旧版本的apache,则用你正在使用的版本replace'current',例如2.0等)