I assume that you are already using Nginx as web server. So this guide covers hosting svn access through Nginx proxy with Apache.

Install required packages :

apt-get install apache2 subversion libapache2-svn apache2-utils  

Create svn folder for repositories :

mkdir /var/svn  
chown www-data.www-data /var/svn/  

Modify your apache /etc/apache2/ports.conf file to listen for a different port than 80. Because port 80 is already used by Nginx.

\# If you just change the port or add more ports here, you will likely also  
\# have to change the VirtualHost statement in  
\# /etc/apache2/sites-enabled/000-default.conf

Listen 81

<IfModule ssl_module>  
Listen 443  
</IfModule>

<IfModule mod_gnutls.c>  
Listen 443  
</IfModule>  

If you plan to use Apache only for svn http access then you can modify /etc/apache2/sites-available/000-default.conf directly, otherwise you shoul create a virtual host file in /etc/apache2/sites-available and enable it via a2ensite.

Apache virtual host configuration file :

<VirtualHost *:81>  
#ServerName www.example.com

ServerAdmin webmaster@localhost  
DocumentRoot /var/www/html

ErrorLog ${APACHE\_LOG\_DIR}/error.log  
CustomLog ${APACHE\_LOG\_DIR}/access.log combined  
</VirtualHost>  

Enable needed apache modules :

a2enmod dav\_svn auth\_basic authz\_svn authn\_file  

Edit configuration file for dav_svn /etc/apache2/mods-available/dav_svn.conf

<Location /svn>  
DAV svn  
SVNParentPath /var/svn

\# We are giving repository-wide auth to users  
AuthType Basic  
AuthName "Goltas SVN"  
AuthUserFile /etc/apache2/dav_svn.passwd

#Here we define repository based auth settings file  
<IfModule mod\_authz\_svn.c>  
AuthzSVNAccessFile /etc/apache2/dav_svn.authz  
</IfModule>

Require valid-user  
Satisfy Any

</Location>  

Create svn repository auth settings file, and a basic config sample :

nano /etc/apache2/dav_svn.authz  
[groups]

[/]  
#cagatay will access all repositories with read and write grants:  
cagatay = rw 

[/sample_poject]  
#auser will only have read access for only "sample_project" :  
auser = r  

Create a password file and add user “cagatay” to it :

htpasswd -c /etc/apache2/dav_svn.passwd cagatay  

To add another user to password file :

htpasswd /etc/apache2/dav_svn.passwd anotherusername  

Finally, restart apache :

/etc/init.d/apache restart  

Configure Nginx as proxy pass for apache svn :

nano /etc/nginx/sites-available/svn  
upstream svnapache {  
    server 127.0.0.1:81;  
}

server {  
    server_name svn.yourdomain.com;  
    listen :80;
    
    client\_max\_body_size 500M;
    
    root /var/www;  
    index index.html index.htm;
    
    access_log /var/log/nginx/svn.access.log;  
    error_log /var/log/nginx/svn.error.log;
    
    location / {  
        proxy_pass http://svnapache;  
        proxy\_next\_upstream error timeout invalid\_header http\_500 http\_502 http\_503 http_504;  
        proxy_redirect off;  
        proxy_buffering off;  
        proxy\_set\_header Host $host;  
        proxy\_set\_header X-Real-IP $remote_addr;  
        proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
    }  
}  

Symlink to enable it :

ln -s /etc/nginx/sites-available/svn /etc/nginx/sites-enabled/svn  

Restart nginx :

/etc/init.d/ngix restart  

To create a new sv repository :

cd /var/svn  
svnadmin create a\_new\_project_name  
chown -R www-data:www-data ./a\_new\_project_name