Monday, August 18, 2008

A brief Apache 2.2.9/Subversion 1.4.6 diversion

If you read the SVN Book chapter on serving SVN via Apache 2 you will see very simple Apache 2.0 virtual host examples that are implicitly correct. They’re in a book, after all. Apache gives good error messages but the one I got when I set everything up following the second example, like so:



DAV svn

# any "/svn/foo" URL will map to a repository /usr/local/svn/foo
SVNParentPath /usr/local/svn

read like this:

client denied by server configuration: /usr/htdocs

referring to a path that is nowhere in any of the .conf files for my Apache instance – it must be hardwired in somewhere, but I didn’t find out where.

I played about with permissions, to no avail*.

What I needed to do was add the conventional access controls, which of course might form part of the main Apache config on a given server (and therefore be inherited by the virtual host). In my case, and reflecting what’s happening gradually across all distributions and indeed the Apache source, there is much tighter security in the default configuration. Explicitly adding


Order allow,deny
Allow from all

(plus authorisation directives) got me back on track.



ServerName my.example.com

DAV svn
SVNParentPath /path/to/repositories
Order allow,deny
Allow from all
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /path/to/htpasswdfile
Require valid-user


* this is Linux therefore whichever user will run the Apache process that serves the files needs to have read and write access to the repository and also read access to the parent directory, so check your group and world permissions on that directory.

1 Comments:

Blogger faultybrew said...

Thank you!

After hours of search, your post solved my issue! I signed up just to say thanks.

6:10 AM  

Post a Comment

<< Home