Configure apache for multiple svn repositories

Author: Steven Neiland
Published:

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

Setting up a apache for a SVN Repo is well documented, but only for single repositories. What if you want multiple?

Define a single repository in vhosts

In all the documentation on subversion, when the author details setting up the location of a repository they use something like this.

<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot "/htdocs"
<Location "/snv/myrepository">
Dav svn
SVNPath "/svn/myrepository"
---snip---
</Location>
</VirtualHost>

This results in you being able to reference the repository "myrepository" by visiting the url:

http://yourdomain.com/svn/myrepository"

This works fine when you have a single repository, but what if you have several.

SVN Parent Path

Now you could simply copy and paste the Location directives for each repo....or you could use Parent Path directive. The SVNParentPath directive allows us to define the path to the parent folder in which all our repositories are located. To use it see the following example.

<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot "/htdocs"
<Location "/snv">
Dav svn
SVNListParentPath on
SVNParentPath "/svn"
---snip---
</Location>
</VirtualHost>

Note the addition of the SVNListParentPath directive and the change from SVNPath to SVNParentPath. These changes create a root directory reference which lists all our repositories in the referenced location (provided they are all stored in the same location of course).

Accessing the repository listing is now as simple as visiting the url "http://yourdomain.com/svn/". You can then view all the listed repositories and click through to each one. The previous url for the "myrepository" repo is still valid, we just no longer have to explicitly define it in the location section.

Related Blog Postings

Reader Comments

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain advertisments or appear to be created for the purpose of link building, will not be published.

Archives Blog Listing