Important Warning

This will not work with current versions of svn until is applied (currently targetting lighttpd 1.4.40)

See ticket #631 for more information.

Apache+Subversion Recipe

This recipe shows how to setup an example subversion repository using Apache 2.2, mod_dav_svn, and lighttpd 1.4.11.

We will create a subversion repository hosted at the example address: ``.

Before you continue, make sure you have installed:

# groupadd svn
# useradd svn

Create test repository

Create the subversion repository, and set its owner and group to svn:

# mkdir -pm700 /var/svn/
# svnadmin create /var/svn/
# chown -R svn:svn /var/svn/

NB: This implies that you are running Apache from that user:group too.

Setup Apache

Create the directory for the domain public files:

# mkdir -p /var/www/

Setup a virtual host inside httpd.conf:

<VirtualHost *:8080>
    DocumentRoot /var/www/

    <Location /svn/test>
        DAV svn
        SVNPath /var/svn/
        AuthType Basic
        AuthName "Test Subversion repository" 
        AuthUserFile /var/svn/
        Require valid-user
        Order allow,deny
        Allow from all

Create a users database for the example user:

# htpasswd -cm /var/svn/ example

Change Apache User and Group variables from:

User apache
Group apache


User svn
Group svn

For more information, see the Version Control with Subversion book chapter httpd, the Apache HTTP server.

Notice: If using SSL with Lighttpd change ServerName to `` or some Subversion commands may not work.

Setup Lighttpd

Setup Lighttpd to use mod_proxy to proxy requests to Apache at port 8080:

$HTTP["host"] == "" {
    server.document-root = "/var/www/" 
    proxy.server = (
        "/svn/test" => (("host" => "", "port" => 8080))

Test the setup

Restart Apache and Lighttpd.

Perform initial project import, checkout the test repository, and commit some stuff:

$ svn import /var/www/ file:///var/svn/ -m "Initial import" 
$ svn checkout --username example
$ cd test
$ svn mkdir testbranches tags trunk
$ svn commit

And you should be up and running!

If you have any question, contact us using our Forum!

Updated by gstrauss about 8 years ago · 16 revisions