You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SVN与LDAP配置异常:虚拟主机显示仓库目录列表而非仓库树

问题修复方案

核心问题定位

你的svn.test.example.com.conf存在两个关键配置错误:

  • 误用SVNParentPath:该指令用于指向存放多个SVN仓库的父目录,但你的单个仓库直接位于/srv/svn下,应该用SVNPath指定单个仓库的根路径。
  • 错误开启SVNListParentPath On:该配置会让Apache尝试列出父目录下的所有仓库,而/srv/svn本身是仓库根目录,并非仓库父目录,因此导致显示错误的文件系统列表。

修正后的svn.test.example.com.conf配置

<VirtualHost *:80>
    ServerName svn.test.example.com
    ServerAdmin  webmaster@localhost
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

<VirtualHost *:443>
    ServerName svn.test.example.com
    ServerAdmin  webmaster@localhost
 
    SSLCertificateFile /etc/pki/tls/certs/svn.test.example.com.pem
    SSLCertificateKeyFile /etc/pki/tls/private/svn.test.example.com.key
    LogLevel debug
    CustomLog logs/svn common

    <Location />
        DAV svn
        # 替换为SVNPath指向单个仓库根目录
        SVNPath "/srv/svn"
        SVNReposName "example Subversion Repository"
        # 移除导致错误列表的配置
        SVNPathAuthz short_circuit
        AuthType Basic
        AuthName "SVN"
        AuthBasicProvider example-ad 
        # 应用LDAP组权限策略
        Use SVNDefault
    </Location>
</VirtualHost>

额外LDAP配置修正

检查ldap.conf发现第二个组的DN格式错误,原配置缺少OU=前缀:
原错误配置:

<AuthzProviderAlias ldap-group group2 "cn=Dev group 2,groups,ou=example,dc=win,dc=example,dc=com">

修正为:

<AuthzProviderAlias ldap-group group2 "cn=Dev group 2,OU=groups,OU=example,DC=win,DC=example,DC=com">

该错误会导致group2的授权验证失败,必须修正才能让对应权限生效。

验证步骤

  1. 重启Apache服务:systemctl restart httpd
  2. 访问https://svn.test.example.com,完成LDAP认证后即可正常查看SVN仓库树。

内容的提问来源于stack exchange,提问作者Mose

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 20:24:51