apache2 摘要认证

ene*_*ene 6 server apache2

这是我在 Ubuntu 服务器 11.10 上的站点文件:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/mydir
    ServerAlias *.mydomain.no-ip.info
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/mydir>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    #   SSL Engine Switch:
    #   Enable/Disable SSL for this virtual host.
    SSLEngine on

    #   A self-signed (snakeoil) certificate can be created by installing
    #   the ssl-cert package. See
    #   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
    #   If both key and certificate are stored in the same file, only the
    #   SSLCertificateFile directive is needed.
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
 </VirtualHost>
 </IfModule>
Run Code Online (Sandbox Code Playgroud)

现在我想要对目录的授权访问:

/var/www/mydir/private
Run Code Online (Sandbox Code Playgroud)

我创建了这样的摘要文件:

sudo htdigest -c /etc/apache2/digest_auth users enedene
Run Code Online (Sandbox Code Playgroud)

所以我在 <\Virtualhost> 之前添加了以下内容:

<Directory "/var/www/mydir/private/">
            AuthType Digest
            AuthName "Private"
            AuthDigestProvider file
            AuthUserFile /etc/apache2/digest_auth
            Require enedene
</Directory>
Run Code Online (Sandbox Code Playgroud)

我重新启动了网络服务器,当我去链接时:

https://mydomain.no-ip.info/private
Run Code Online (Sandbox Code Playgroud)

我得到了我想要的用户名和密码的提示,但问题是它除了我创建的用户/密码之外没有,它只是不断地拒绝并再次提示,好像用户名/密码组合是错误的。
我的设置有什么问题?

编辑:
这是 /var/log/apache2/error.log 所说的:

[Wed Dec 07 18:00:47 2011] [error] [client 188.129.120.255] File does not exist: /var/www/mydir/favicon.ico
[Wed Dec 07 18:01:07 2011] [error] [client 188.129.120.255] Digest: user `enedene' in realm `Private' not found: /private
Run Code Online (Sandbox Code Playgroud)

第一行是当我连接到站点时,但站点可以工作,第二行是当我尝试访问 /var/www/mydir/private 目录时,浏览器进行身份验证但我无法进入。

编辑 2:
将 AuthName 更改为“users”后出现新错误:

[Wed Dec 07 18:07:59 2011] [error] [client 188.129.120.255] access to /private failed, reason: require directives present and no Authoritative handler.
Run Code Online (Sandbox Code Playgroud)

Sab*_*con 5

我相信由于您的领域是用户,那么您的 AuthName 指令应该是“用户”

而不是 AuthNmae “Private” 尝试, AuthName “users” 重新启动 apache ;

须藤服务 apache2 重新加载