Nginx – installing SVN server using NGINX

apache-2.2nginxsvn

I am trying to install SVN server and use it with my NGINX webserver.
i have tried this
in server section in nginx/sites-enabled/svn i have added this

  location /var/svn/repos {
        proxy_pass      http://127.0.0.1:81;
        #include         /etc/nginx/proxy.conf;
        set  $dest  $http_destination;
        if ($http_destination ~ "^https://(.+)") {
           set  $dest   http://$1;
        }
       proxy_set_header  Destination   $dest;
        }

and i am running apache on port 81
and have made the virtual host that were running 100% on apache.
now whenever i try to svn checkout, i get this:

$ svn co http://svn.mysite.com/myrepo
svn: Server sent unexpected return value (500 Internal Server Error) in response to OPTIONS request for 'http://svn.mysite.com/myrepo'

and in error log i have this

2012/04/18 07:43:36 [error] 9914#0: *106 rewrite or internal redirection cycle while internal redirect to "/index.html", client: 93.95.201.250, server: mysite.com, request: "GET /myrepo HTTP/1.1", host: "svn.mysite.com"

Do anybody know how to install svn server on nginx?
any idea is highly appreciated?
Thanks for your help

Best Answer

I have had success with something like this. You might be able to simplify it even more, but it might provide you with a working configuration.

In nginx.conf (or other .conf-file under /etc/nginx/conf.d):

location /var/svn/repos {
    # the "proxy_set_header Destination"-stuff is moved to apache's config - see below
    proxy_pass http://127.0.0.1:81/var/svn/repos;
}

Then in /etc/httpd/conf.d/subversion.conf

...
<VirtualHost *:81>
    RequestHeader edit Destination ^https http early

    <Location /var/svn/repos>
        DAV svn
        SVNPath /var/svn/repos
    </Location>
</VirtualHost>