运行 Ubuntu 14.06、apache 2.4.7 和 subversion 1.8.8
这是我的 dav_svn.conf 文件
<Location /svn>
DAV svn
SVNPath /opt/svn/production/
AuthType Basic
AuthName "SvnTest"
AuthBasicProvider ldap
AuthLDAPBindDN "Account Here"
AuthLDAPBindPassword "Password Here"
AuthLDAPURL "LDAP server here"
Require valid-user
</location>
当我去http://本地主机/svn,我明白了
<D:error xmlns:D="DAV:" xmlns:m="http://apache.org/dav/xmlns" xmlns:C="svn:">
<C:error/>
<m:human-readable errcode="2">Could not open the requested SVN filesystem</m:human-readable>
</D:error>
在 /var/log/apache2/error.log 文件夹中,我看到以下条目
mod_dav_svn: nested Location '/svn' hinders access to '' in SVNPath Location '/svn'
(20014)Internal error: [client ipaddrhere] Can't open file 'a path here that isn't ANYWHERE/format': No such file or directory
在 /opt/svn/production/ 文件夹中,我执行了 chown -R www-data:www-data *
奇怪的是,当我将位置从 /svn 更改为 /production 并转到http://本地主机/生产,它起作用了。通常我不会在意,但项目负责人希望 URL 是http://本地主机/svn。
我对 Linux 还很陌生,因为我来自微软。所以我肯定我只是错过了一些非常简单的东西。
答案1
您的服务器上只有一个 repo 吗?
此类错误经常导致以下设置
<Location /svn>
...
SVNPath /opt/repos/svn
</Location>
<Location /svn/project1>
...
SVNPath /opt/repos/project1
</Location>
所以你应该检查所有的 apache 配置
过去 5 年来我一直使用以下模板
<VirtualHost *:80>
ServerName svn.example.net
DocumentRoot /vhosts/svn.example.net/
<Directory /vhosts/svn.example.net/>
Options -Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Location />
AuthBasicProvider ldap
AuthType Basic
AuthzLDAPAuthoritative on
AuthName "Authorization required."
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
AuthLDAPBindDN uid=ldap_reader,ou=System,ou=users,dc=example,dc=com
AuthLDAPBindPassword 1234567
AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?sub
Require ldap-group cn=svn,ou=groups,dc=example,dc=com
</Location>
<Location /repos/project1>
DAV svn
SVNReposName PROJECT1
SVNPath /svn/repos/project1
SVNIndexXSLT "/svnindex.xsl"
</Location>
<Location /repos/project2>
DAV svn
SVNReposName PROJECT2
SVNPath /svn/repos/project2
SVNIndexXSLT "/svnindex.xsl"
</Location>
</VirtualHost>