NGINX没有启动git-http-server

时间:2017-06-07 16:49:01

标签: nginx nginx-location git-http-backend

我正在使用git git-http-backend脚本在Nginx后面的Git服务器上工作。

目前,我有一个乘客服务器正在为2222端口的rails应用程序提供服务。 但是,在/ git /文件夹后面我想要提供git存储库。问题是,Nginx似乎没有启动脚本。无论我使用套接字文件还是其他localhost帖子,我都会收到502错误。这显示在Nginx错误日志中:

2017/06/07 18:43:03 [error] 2147#0: *3 no live upstreams while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /git/me/repo HTTP/1.1", upstream: "fastcgi://localhost", host: "localhost:2222"

似乎nginx没有启动处理git文件的过程。

这是我在nginx设置中的位置部分:

 location ~ /git(/.*) {
  include fastcgi.conf;
  include       fastcgi_params;
  #fastcgi_pass  127.0.0.1:8888;
  fastcgi_param SCRIPT_FILENAME /Library/Developer/CommandLineTools/usr/libexec/git-core/git-http-backend;
  # export all repositories under GIT_PROJECT_ROOT
  fastcgi_param GIT_HTTP_EXPORT_ALL "";
  fastcgi_param GIT_PROJECT_ROOT /Users/userx/Documents/Projecten/repositories;
  fastcgi_param PATH_INFO           $1;


  fastcgi_keep_conn on;
  fastcgi_connect_timeout 20s; 
  fastcgi_send_timeout 60s; 
  fastcgi_read_timeout 60s;
  #fastcgi_pass 127.0.0.1:9001;
  fastcgi_param REMOTE_USER $remote_user;
  #fastcgi_pass unix:/var/run/fcgi/fcgiwrap.socket;
  fastcgi_pass localhost:9001;

}

我无法独自解决,有人可以分享他们的想法吗?

1 个答案:

答案 0 :(得分:0)

检查nginx是否可以将文件写入包含git repo的文件夹。 Nginx 以用户 www-data:www-data 运行,因此这些文件可能具有以下文件的权限:

permission owner      group    file
drwxr-xr-x www-data   www-data ./repoA
dr-xrwxr-x some-owner www-data ./repoB
drwxr-xr-x some-owner www-data ./repoError502