Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given a typical Subversion/Apache configuration using SVNParentPath, with repositories hosted under /svn/ like this:

<Location /svn>
    DAV svn

    SVNParentPath /srv/source/svn/repos
    SVNReposName "Subversion Repository"

    AuthzSVNAccessFile /srv/source/svn/authz
    Satisfy Any

    AuthType                Basic
    AuthBasicProvider       file
    AuthName "Subversion Repository"
    AuthUserFile /srv/source/svn/htpasswd

    Require valid-user

Is there a way to override this configuration for specific repositories without having to host them at a different path? That is, is there any way I can add a Location block like this...

<Location /svn/my_special_repo>
    SVNPath /srv/source/svn/repos/my_special_repo
    AuthzSVNAccessFile /srv/source/svn/repos/my_special_repo/conf/authz

...and have it override the configuration provided in the Location block for /svn? My attempts at doing this with the above configuration have been met with weird and unhelpful errors in the Apache error log, such as:

[Wed Feb 02 11:28:35 2011] [error] [client]
(20014)Internal error: Can't open file '/srv/source/svn/repos/svn/format':
No such file or directory

All this seems to be mod_dav_svn's way of telling me that I can't do what I'm trying to do. I'm open to solutions or alternatives!

EDIT: Well, I can see that this question has generated a lot of excitement among the readership. For the record, what I may end up doing is generating per-repository configurations for all of our existing repositories, and then abandoning the SVNParentPath based configuration. The per-repo Apache configuration is minimal, especially using something like mod_macro; the hard part will be splitting apart the global authz file. If you've done this before, tips are appreciated.

share|improve this question
I've got the same problem, and solved it by using mod_macro. Thanks!!! (It seems to be an old bug in either Apache or Subversion.) – Achimnol Mar 21 '11 at 14:50
up vote 3 down vote accepted

I hate to see my own question languishing there in the unanswered questions list, so here's what we did:

  • In our main server configuration, we have:

      <Location /svn/>
            SVNParentPath /srv/source/svn/repos
  • We adopted the following mod_macro to replicate this behavior for new repositories:

    <Macro LegacySubversionRepo $name>
        # Override SVNParentPath block in main vhost config.
        RewriteRule ^/svn/$name /repo/$name [PT]
        <Location /repo/$name>
                Order                   deny,allow
                Allow                   from all
                Use LdapAuth \
                        "$name svn repository" \
                DAV svn
                SVNPath /srv/source/svn/repos/$name
                AuthzSVNAccessFile /srv/source/svn/authz
                SVNAutoversioning On
                Satisfy Any

    The RewriteRule allows the repository configuration to override the <Location /svn/> in the main config that would otherwise match the request.

With this in place, it becomes relatively easily to adopt per-repository authentication and authorization configuration (instead of the global htpasswd file used here).

share|improve this answer
mod_macro rocks – vinnyjames Aug 13 '12 at 18:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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