Project

General

Profile

Actions

ApacheSubversionRecipe » History » Revision 10

« Previous | Revision 10/16 (diff) | Next »
Anonymous, 2007-12-08 03:10


Important Warning

With lighttpd 1.4.18, and probably several other versions, you might not be able to commit to the repository! You'll get errors like:

{{{
svn: Commit failed (details follow):
svn: OPTIONS request failed on '/svn/a/b/c'
svn: OPTIONS of '/svn/a/b/c': 200 OK (https://dev.yoursite.com)
}}}

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.

Be warned that this will not work correctly until ticket #631 is fixed!

We will create a subversion repository hosted at the example address: `http://projects.example.com/svn/test/`.

Before you continue, make sure you have installed:

=== Create test repository ===

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

{{{
#!ShellExample
  1. mkdir -pm700 /var/svn/projects.example.com
  2. svnadmin create /var/svn/projects.example.com/test
  3. chown -R svn:svn /var/svn/projects.example.com
    }}}

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

=== Setup Apache ===

Create the directory for the `projects.example.com` domain public files:

{{{
#!ShellExample
  1. mkdir -p /var/www/projects.example.com/httpdocs
    }}}

Setup a virtual host inside `httpd.conf`:

{{{
<VirtualHost *:8080>
ServerName projects.example.com
DocumentRoot /var/www/projects.example.com/httpdocs

&lt;Location /svn/test&gt;
DAV svn
SVNPath /var/svn/projects.example.com/test
AuthType Basic
AuthName "Test Subversion repository"
AuthUserFile /var/svn/projects.example.com/test/conf/users
Require valid-user
Order allow,deny
Allow from all
&lt;/Location&gt;
&lt;/VirtualHost&gt;
}}}

Create a users database for the `example` user:

{{{
#!ShellExample
  1. htpasswd -cm /var/svn/projects.example.com/test/conf/users example
    }}}

For more information, see the [http://svnbook.red-bean.com/ Version Control with Subversion] book chapter [http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.serverconfig.httpd httpd, the Apache HTTP server].

Notice: If using SSL with Lighttpd change !ServerName to `https://projects.example.com` or some Subversion commands may not work.

=== Setup Lighttpd ===

Setup Lighttpd to use [http://lighttpd.net/documentation/proxy.html mod_proxy] to proxy requests to Apache at port 8080:

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

=== Test the setup ===

Restart Apache and Lighttpd.

Checkout the test repository, and commit some stuff:

{{{
#!ShellExample
$ svn checkout --username example http://projects.example.com/svn/test
$ 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 [http://forum.lighttpd.net/forum/1 Forum]!

Updated by Anonymous almost 17 years ago · 10 revisions