svn使用nginx提交失败:找不到路径

时间:2012-05-14 08:19:42

标签: apache svn nginx

我在我的nginx网络服务器上构建了svn服务器。我的nginx配置是

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;
        }
}

现在,我可以 svn co <​​/ b>和 svn up ,而不会有任何问题 当我尝试提交时我得到错误:

$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

如果我尝试在端口81(我的proxy_pass是apache)上svn co然后svn ci,它将顺利运行! 但是当我使用nginx来完成它时为什么它不起作用呢? 任何想法都受到高度赞赏。

1 个答案:

答案 0 :(得分:0)

https://serverfault.com/questions/388835/svn-using-nginx-commit-failed-path-not-found/389021#answer-389021'>从服务器故障中退出 请求被.php $ location块捕获,并通过FastCGI传递给PHP。您需要确保SVN请求始终代理到Apache。如果您在此虚拟主机上不需要PHP,只需删除该位置指令即可。如果在特定路径下需要PHP,请使位置块更具体,例如^ / phpstuff /.*。php $。如果无法做到这一点,请在PHP之前添加一个空位置块来捕获SVN repo路径下的.php文件,例如:

location ~ ^/elpis-repo/.*\.php$ {}


参考: https://serverfault.com/questions/388835/svn-using-nginx-commit-failed-path-not-found/389021#answer-389021