guest@6admin.io:~$

Subversion: a WebSVN with mod_dav and mod_svn for Apache

Subversion has two access modes: svnserve (standalone daemon, svn:// protocol) and Apache with mod_dav_svn (http:// or https:// protocol). The Apache mode exposes the repository via HTTP, with Apache authentication, Apache SSL and WebSVN for web browsing of the sources.

The mod_dav_svn module

apt-get install libapache2-svn

This package installs mod_dav and mod_dav_svn (the module that exposes SVN repositories via WebDAV).

The Apache configuration

# /etc/apache2/sites-available/svn
<Location /svn>
    DAV svn
    SVNParentPath /var/svn
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd
    Require valid-user
</Location>
  • DAV svn : activates SVN mode
  • SVNParentPath /var/svn : the directory containing the repositories (one repo per subdirectory)
  • AuthUserFile : the htpasswd file for authentication

Create the repository and the password file:

svnadmin create /var/svn/projet1
htpasswd -c /etc/apache2/dav_svn.passwd user1
htpasswd /etc/apache2/dav_svn.passwd user2
chown -R www-data:www-data /var/svn/projet1

Apache must own the repository (it writes to the repository at every commit).

The checkout

svn checkout http://server/svn/projet1

The protocol is http:// (or https:// if mod_ssl is enabled), not svn://: Apache serves the repository, not svnserve.

WebSVN

WebSVN is a PHP application that browses SVN repositories: files, diffs, logs, blame. It does not do checkouts, it does read-only browsing.

apt-get install websvn

WebSVN configuration points to the repositories:

// /etc/websvn/config.php
$config->parentPath('/var/svn');
$config->useAuthentication();

WebSVN is accessible at http://server/websvn/ and it browses all repositories in /var/svn.

SVNParentPath vs SVNPath

  • SVNParentPath /var/svn : exposes ALL subdirectories of /var/svn as repositories. The URL is http://server/svn/projet1, http://server/svn/projet2, etc.
  • SVNPath /var/svn/projet1 : exposes ONE repository. The URL is http://server/svn and that repository only.

SVNParentPath is the multi-project pattern: one parent directory, multiple repositories, one Apache block.

[edit: 2026] Subversion has given way to Git in 95% of projects, but mod_dav_svn still exists and still serves in enterprises with SVN heritage. WebSVN has been replaced by Git web interfaces (GitLab, Gitea, Gogs) that do browsing + hosting + CI. The Apache-exposed-repository pattern (exposing a VCS via HTTP/HTTPS with Apache authentication) remains relevant for environments where you cannot install a dedicated service, but Git simplified the pattern: git http-backend + smart HTTP, or simply a remote on a file path (git clone /path/to/repo).