Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to have my svn/http server setup so I can access multiple repositories via a "svn" subdomain:

I am using Debian 6, and already have multiple vhosts set up via the standard sites-available method.

Resources and their problems:

How To: subversion SVN with Apache2 and DAV

This one doesn't deal with a server with multiple vhosts.

Installing and Configuring Subversion
  • This one only considers one subversion repository.
  • This one does show putting the SVN DAV <Location> in the svn vhost file.
    • However, it doesn't say whether to put it inside or outside the <VirtualHost> tag.
    • Does this really limit the subversion access to just that vhost? I just tried, and can access /foorepo from any subdomain.
Setting Up Subversion And Trac As Virtual Hosts On An Ubuntu Server
  • This one appears to be very close, but I can still access repos from any vhost. In other words, it doesn't matter what subdomain I specify, as long as the path matches the repo name. Doesn't make any sense. And yes, my <Location> tag is inside the <VirtualHost>.

A lot of these articles seem to have been written in 2006 or earlier, and don't necessarily conform to the configuration methods that newer distros are using.

Can anyone guide me in the right direction?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

configuration methods that newer distros are using

Does not correlate in any way with configuring SVN-WebDAV inside 1. one 2. any 3. (forgot)... site inside Apache installation, regardless of whether Main Site container or VirtualHost container used. If you can't understand settings of httpd.conf and translate it into "actions and results" - it is not problem of documentation, it's mind-troubles, personally yours.

I am still very good today's morning, you have cause to be happy.

Let's explore your business-task

have my svn/http server setup so I can access multiple repositories via a "svn" subdomain

which translated to technical task as

  • Have (virtual) host svn.example.com
  • Have SVN-DAV in the root of host
  • Easy management of multiply repos under root require to use SVNParentPath
  • Add SSL-support after all

Implementation

  1. Creating vhost svn (leave this task for you)
  2. Adding to Apache config needed for Subversion modules (LoadModule task leave for you)
  3. Configure Location for SVN

We'll use config from Subversion Book, end of chapter "Basic Apache Configuration", as starting point

<Location /svn>
  DAV svn

  # Automatically map any "/svn/foo" URL to repository /var/svn/foo
  SVNParentPath /var/svn
</Location>

Move Location container inside VirtualHost (Name-based virtualhost) container (because inversed nesting just impossible), fix location path

ServerName svn.example.com DocumentRoot /home/svn.example.com/docroot

<Location />
    SVNParentPath /home/svn.example.com/svnroot
    SVNListParentPath on
</Location>

but /etc/apache2/conf.d/subversion.conf have hints

Do not set DocumentRoot. It is not needed here and just causes trouble.

and

Map the error documents back to their defaults.

Otherwise mod_dav_svn tries to find a "error" repository.

but with different paths in DocumentRoot and SVNParentPath virthost works (DocumentRoot simply never used, because / intercepted by dav_svn) and ErrorDocument directives added just for sake comfort "if error will happen, we get usual answer without misinterpretation"

<VirtualHost *:80>
    ServerName svn.example.com
    DocumentRoot /home/svn.example.com/docroot

    <Location />
        SVNParentPath /home/svn.example.com/svnroot
        SVNListParentPath on
    </Location>

    ErrorDocument 400 default
    ErrorDocument 401 default
    ErrorDocument 403 default
    ErrorDocument 404 default
    ErrorDocument 405 default
    ErrorDocument 408 default
    ErrorDocument 410 default
    ErrorDocument 411 default
    ErrorDocument 412 default
    ErrorDocument 413 default
    ErrorDocument 414 default
    ErrorDocument 415 default
    ErrorDocument 500 default
    ErrorDocument 501 default
    ErrorDocument 502 default
    ErrorDocument 503 default
</VirtualHost>
share|improve this answer
add comment

Your Answer

 
discard

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.