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>

现在我想授权访问目录:

/var/www/mydir/private

我创建了摘要文件,如下所示:

sudo htdigest -c /etc/apache2/digest_auth users enedene

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

<Directory "/var/www/mydir/private/">
            AuthType Digest
            AuthName "Private"
            AuthDigestProvider file
            AuthUserFile /etc/apache2/digest_auth
            Require enedene
</Directory>

我重新启动了Web服务器,当我转到链接时:

https://mydomain.no-ip.info/private

我得到想要的用户名和密码提示,但问题是它不只是我创建的用户名/密码,而是不断拒绝并再次提示,就像用户名/密码组合错误一样。
我的设置有什么问题?

编辑:
这是/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

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

编辑2:
将AuthName更改为“用户”后,出现新的错误:

[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.
沙巴康

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

代替AuthNmae“ Private”尝试,AuthName“ users”用以下命令重新启动apache;

sudo服务apache2重新加载

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章