Apache 配置:权限、目录和位置

Apache 配置:权限、目录和位置

我正在尝试弄清楚 apache 配置如何解决我遇到的问题,但几个小时后我决定在这里询问。

这是我目前得到的:

DocumentRoot "/var/www/html"

<Directory />
        Options None
        AllowOverride None
        Deny from all
</Directory>

<Directory /var/svn>
        Options FollowSymLinks
        AllowOverride None
        Allow from all
</Directory>

<Directory /opt/hg>
        Options FollowSymLinks
        AllowOverride None
        Allow from all
</Directory>

<Location /hg>
        AuthType Digest
        AuthName "Engage HG"
        AuthDigestProvider file
        AuthUserFile /opt/hg/hgweb.users
        Require valid-user
</Location>

WSGISocketPrefix /var/run/wsgi
WSGIDaemonProcess hg processes=3 threads=15
WSGIProcessGroup hg
WSGIScriptAlias /hg "/opt/hg/hgweb.wsgi"

<Location /svn>
        DAV svn
        SVNPath /var/svn/repos

        AuthType Basic
        AuthName "Subversion"
        AuthUserFile /etc/httpd/conf/users
        require valid-user
</Location>

我试图弄清楚它的布局以及目录与位置等的关系

对于 /hg 我被要求输入密码,但是对于 /svn 我得到了 403 禁止...

我收到的错误是:

[客户端 10.80.10.169] 服务器配置拒绝客户端:/var/www/html/svn

当我删除该条目时,它工作正常..

我不知道如何将其链接到 /var/svn 目录

答案1

请检查目录权限:

http://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/

您应该使用相同的身份验证方法:

  • 位置 /hg 使用摘要式身份验证
  • 位置 /svn 使用基本身份验证

并且你的配置可以依赖于继承:

DocumentRoot "/var/www/html"

<Directory />
        Options None
        AllowOverride None
        Deny from all
</Directory>

<Directory /var/svn>
        Options FollowSymLinks
        Allow from all
</Directory>

<Directory /opt/hg>
        Options FollowSymLinks
        Allow from all
</Directory>

<Location /hg>
        AuthType Digest
        AuthName "Engage HG"
        AuthDigestProvider file
        AuthUserFile /opt/hg/hgweb.users
        Require valid-user
</Location>

WSGISocketPrefix /var/run/wsgi
WSGIDaemonProcess hg processes=3 threads=15
WSGIProcessGroup hg
WSGIScriptAlias /hg "/opt/hg/hgweb.wsgi"

<Location /svn>
        DAV svn
        SVNPath /var/svn/repos

        AuthType Digest
        AuthName "Subversion"
        AuthUserFile /etc/httpd/conf/users
        require valid-user
</Location>

确保 AuthUserFiles 存在!

相关内容