vhost setup for multiple SVN repositories on same server

7,746

Solution 1

Because you have set the SVNPath directive, you have "hard coded" the path:

SVNPath /ebs/svn/repo1

Try using the SVNParentPath directive instead, to configure the "top" directory that will hold all your repositories. Replace the above line with this:

SVNParentPath /ebs/svn/

If you want to allow users to view a list of all the available repositories if they just go to svn.mydomain.com, you should also add this line:

SVNListParentPath on

That will allow the listing of all your repositories. Otherwise, a "Forbidden" page will be shown on svn.mydomain.com rather than a list of repositories.

To sum up, here's a complete location block example :


    ‹Location "/"›
        DAV svn
        SVNParentPath /ebs/svn/
        SVNListParentPath On
        SSLRequireSSL
        AuthType Basic
        AuthName "svn ebs"
        AuthUserFile conf/svnpasswd 
        Require valid-user
    ‹/Location›

Solution 2

What I did: (As answered by @Oldskool)

<VirtualHost *:80>
        ServerName svn.mydomain.com
        ServerAlias svn.mydomain.com
        ErrorLog /var/www/html/log/svn.mydomain.com-log
        <Location "/" >
            DAV svn
            # Delete SVNPath!
            SVNParentPath /ebs/svn/ # add this!
            SVNListParentPath on #Lists all the repos!! coool stuff! :D
            AuthType Basic
            AuthName "Private - Repos"
            AuthUserFile /ebs/svn/login/svn-auth-conf
            Require valid-user
       </Location>
</VirtualHost>

Thanks @Oldskool!


Old Way
This is an older way I found, but for multiple repositries, you will have to add multiple tags. (Use @oldSkool's answer above, works much better!) (Noticed the <Location "/repo1">, So basically, add a new location for each repo.

<VirtualHost *:80>
        ServerName svn.mydomain.com
        ServerAlias svn.mydomain.com
        ErrorLog /var/www/html/log/svn.mydomain.com-log
        <Location "/repo1" >
            DAV svn
            SVNPath /ebs/svn/repo1
            AuthType Basic
            AuthName "Private - Repo1"
            AuthUserFile /ebs/svn/login/svn-auth-conf
            Require valid-user
        </Location>
        <Location "/repo2" >
            DAV svn
            SVNPath /ebs/svn/repo2
            AuthType Basic
            AuthName "Private - Repo2"
            AuthUserFile /ebs/svn/login/svn-auth-conf
            Require valid-user
       </Location>
</VirtualHost>
Share:
7,746

Related videos on Youtube

Anil
Author by

Anil

Updated on September 18, 2022

Comments

  • Anil
    Anil over 1 year

    I have 2 svn repos on my EC2 instance.
    They are located in /ebs/svn/repo1 & /ebs/svn/repo2.

    I have created a domain alias svn.mydomain.com, to point to the parent directory of above (/ebs/svn).

    I woud like to access each of the above repo's using the following URL format:
    svn.mydomain.com/repo1
    svn.mydomain.com/repo2

    Currenly I have the repo1 working with the following vhosts config.

    <VirtualHost *:80>
            ServerName svn.mydomain.com
            ServerAlias svn.mydomain.com
            ErrorLog /var/www/html/log/svn.mydomain.com-log
            <Location "/" >
                DAV svn
                SVNPath /ebs/svn/repo1
                AuthType Basic
                AuthName "SVN - Private - Repos"
                AuthUserFile /ebs/svn/login/svn-auth-conf
                Require valid-user
           </Location>
    </VirtualHost>
    

    The problem is, I can only get access to repo1 through the above vhosts config.

    I would like to access both repo's in the following format:
    svn.mydomain.com/repo1
    svn.mydomain.com/repo2

    What do I need to change to access my svn repo's by their directories?

  • Oldskool
    Oldskool over 11 years
    You can do that, but it requires you to add every new repo seperately. Also check out my answer for a more generic approach.
  • sealz
    sealz almost 11 years
    Was getting double teamed by "forbidden" and "Could not open the requested SVN filesystem" errors all morning. Thanks for the answer!