无法打开请求的 SVN 文件系统,文件权限似乎正常

Could not open the requested SVN filesystem, File permissions seem OK

我在通过 HTTP (Apache) 访问我的 SVN 存储库时收到 “无法打开请求的 SVN 文件系统” 错误

httpd.conf

<...>
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
<...>
User svn
Group svn
<...>
<Location /svn>
   DAV svn
   SVNPath /srv/svn
</Location>

SVN 存储库似乎具有正确的权限

[ec2-user@ip-xxx ~]$ ls -lart /srv/svn
total 16
drwxrwxrwx. 3 root root   16 Oct 20 10:58 ..
-rw-rw-r--. 1 svn  svn   229 Oct 20 10:58 README.txt
drwxrwxr-x. 2 svn  svn    39 Oct 20 10:58 locks
drwxrwxr-x. 2 svn  svn  4096 Oct 20 10:58 hooks
drwxrwxr-x. 2 svn  svn    51 Oct 20 10:58 conf
-r--r--r--. 1 svn  svn     2 Oct 20 10:58 format
drwxrwxr-x. 6 svn  svn    80 Oct 20 10:58 .
drwxrwsr-x. 6 svn  svn  4096 Oct 20 10:58 db

我是 运行 Apache 用户 svn

[ec2-user@ip-xxx ~]$ ps auxwww|grep httpd
ec2-user 14304  0.0  0.0 110276   996 pts/0    T    06:07   0:00 less /etc/httpd/conf/httpd.conf
root     15102  0.0  0.5 240004  5496 ?        Ss   08:39   0:00 /usr/sbin/httpd -DFOREGROUND
svn      15103  0.0  0.3 240004  3116 ?        S    08:40   0:00 /usr/sbin/httpd -DFOREGROUND
svn      15104  0.0  0.3 240004  3116 ?        S    08:40   0:00 /usr/sbin/httpd -DFOREGROUND
svn      15105  0.0  0.3 240004  3116 ?        S    08:40   0:00 /usr/sbin/httpd -DFOREGROUND
svn      15106  0.0  0.3 240004  3116 ?        S    08:40   0:00 /usr/sbin/httpd -DFOREGROUND
svn      15107  0.0  0.4 240164  4124 ?        S    08:40   0:00 /usr/sbin/httpd -DFOREGROUND

Apache 错误日志

[Tue Oct 27 08:40:10.515487 2015] [authz_core:debug] [pid 15107] mod_authz_core.c(835): [client ::1:56072] AH01628: authorization result: granted (no directives)
[Tue Oct 27 08:40:10.515747 2015] [:error] [pid 15107] (20014)Internal error: [client ::1:56072] Can't open file '/srv/svn/format': Permission denied
[Tue Oct 27 08:40:10.515760 2015] [dav:error] [pid 15107] [client ::1:56072] Could not fetch resource information.  [500, #0]
[Tue Oct 27 08:40:10.515763 2015] [dav:error] [pid 15107] [client ::1:56072] Could not open the requested SVN filesystem  [500, #13]
[Tue Oct 27 08:40:10.515765 2015] [dav:error] [pid 15107] [client ::1:56072] Could not open the requested SVN filesystem  [500, #13]

SVN 使用 file 访问权限但不使用 http:

[ec2-user@ip-xxx ~]$ svn list file://localhost/srv/svn
branches/
src/
[ec2-user@ip-xxx ~]$ svn list http://localhost/svn
svn: E000013: Unable to connect to a repository at URL 'http://localhost/svn'
svn: E000013: Could not open the requested SVN filesystem

我也尝试将 /srv/svn/format 的权限更改为 666,但没有帮助。

Red Hat Enterprise Linux 服务器版本 7.1。 SVN 版本 1.8.8

错误的原因是 SELinux 模块阻止访问文件。我通过编辑 /etc/selinux/config 文件(参见 how)禁用了 SELinux,并且在重新启动后,svn list http://localhost/svn 终于可以工作了。