Centos – Can Apache on CentOS front a Subversion repository located outside it’s document root directory tree

apache-2.2centosselinuxsvn

If so, how?

This is related to Question 43805. If the repo is properly chmoded but outside the document root directory tree, Apache complains that it can't access the format file in the root of the repo. If the repo is somewhere in the document root directory tree, everything works.

Best Answer

It's certainly possible, I have a similar setup to David (mine is the default setup for Centos):

DocumentRoot /var/www/html/

with the following in my /etc/httpd/conf.d/subversion.conf file (minus comments):

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /svn>
  DAV svn
  SVNParentPath /var/www/svn

  # Limit write permission to list of valid users.
  <LimitExcept GET PROPFIND OPTIONS REPORT>
     # Require SSL connection for password protection.
     # SSLRequireSSL

     AuthType Basic
     AuthName "Subversion Repository"
     AuthUserFile /etc/svn-auth-file
     Require valid-user
  </LimitExcept>
</Location>

Do you have SELinux in Enforcing? You might need to correctly set the context of the files in your /var/www/svn location.

The sestatus command will show you whether you're in Enforcing mode or not. You can (temporarily) use setenforce 0 to switch from Enforcing to Permissive and try again to see if that is the problem.

You want the labelling for the format file to be system_u:object_r:httpd_sys_content_t:s0 (use ls -Z to see SELinux labels for files). You can fix it using restorecon -R /var/www/svn.

For further reading on SELinux, I refer you to the Fedora SELinux User Guide