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.


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.
     # Require SSL connection for password protection.
     # SSLRequireSSL

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

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

| improve this answer | |
  • Thanks. It's definitely an SELinux thing; setenforce 0 let me see the repo no problems. Unfortunately for me, I know nothing about SELinux (I'm a developer, and my Linux-at-home days ended about 5 years ago). ls -Z shows me "root:object_r:user_home_t" for the repo and everything in it. How would I go about setting the context so that Apache could serve it up while leaving it accessible via svn+ssh? Thanks again. – Hank Gay Jul 22 '09 at 18:20
  • Last sentence of the answer: restorecon -R /var/www/svn (note: I'm assuming you've got the repository hosted under /var/www, if they're outside of that then they likely won't automatically pick up the correct context). I have editted my answer to add a link to the SELinux documentation provided by Fedora. – Ophidian Jul 22 '09 at 18:32
  • Thanks for the docs. That's exactly the sort of thing I needed to get up to speed on SELinux. The repository is actually hosted under the svn user's home directory, so it doesn't sound like restorecon will work for this. – Hank Gay Jul 23 '09 at 1:57

This is perfectly fine. You set the path using the SVNPath or SVNParentPath options. You should really have these outside your document root, as they're not meant to be accessed that way.

We have:

DocumentRoot /var/www/svn/ 

<Location /svn>
    SVNParentPath /var/svn
    DAV svn
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.