Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have built svn server on my nginx webserver. my nginx configuration is

server {
        listen  80;
        server_name svn.mysite.com;
        location / {
        access_log off;
        proxy_pass http://svn.mysite.com:81;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

Now, i can svn co and svn up normally without having any problem and when i try to commit i get error:

$svn up
At revision 1285.
$ svn info
Path: .
URL: http://svn.mysite.com/elpis-repo/crons
Repository Root: http://svn.mysite.com/elpis-repo
Repository UUID: 5303c0ba-bda0-4e3c-91d8-7dab350363a1
Revision: 1285
Node Kind: directory
Schedule: normal
Last Changed Author: alaa
Last Changed Rev: 1280
Last Changed Date: 2012-04-29 10:18:34 +0300 (Sun, 29 Apr 2012)

$svn st
M       config.php
$svn ci -m "Just a test, add blank line to config" config.php
Sending        config.php
svn: Commit failed (details follow):
svn: File 'config.php' is out of date
svn: '/elpis-repo/!svn/bc/1285/crons/config.php' path not found

if i try to svn co on port 81 (my proxy_pass which is apache) and then svn ci, it will work smoothly! but why it doesn't work when i use nginx to accomplish it?
any idea is highly appreciated.

share|improve this question
    
What do your Nginx logs say? Also, I typically put the proxy information in a location / {...} block, instead of direction in the server {...} block. I typically proxy Apache to Nginx... not the other way around. :P –  Taylor Jasko May 14 '12 at 14:24

2 Answers 2

up vote 3 down vote accepted

The request is being caught by your \.php$ location block, and being passed to PHP via FastCGI. You need to make sure that SVN requests are always proxied to Apache. If you don't need PHP on this virtual host, just remove that location directive. If you need PHP under specific paths, make the location block more specific, such as ^/phpstuff/.*\.php$. If that isn't possible, add an empty location block before the PHP one to catch .php files under the SVN repo paths, such as:

location ~ ^/elpis-repo/.*\.php$ {}
share|improve this answer
    
super like :) thanks a lot –  Alaa Alomari May 15 '12 at 6:20

And if you want to proxy requests from only "svn.mysite.com/elpis-repo" to subversion and the rest to web server, then use this

location ~ ^/elpis-repo {}
share|improve this answer

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.