0

I'm working on a Git server behind Nginx using the git git-http-backend script.

Currently I have a passenger server that's working serving a rails app at port 2222. However, behind the /git/ folder I want to serve git repositories. The thing is, Nginx doesn't seem to start the script. Whether I use a socket file or a different localhost post, I get a 502 error. This is showing in the Nginx Error Log:

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"

It seems nginx is not starting the process to handle the git files.

This is my location part of the nginx setup:

 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;

}

I can't figure it out alone, can anybody share their thoughts on this?

gigha
  • 41
  • 1
  • 10
  • Did you find a solution? I get a slightly different error message, but probably a releated problem. connect() failed (111: Connection refused) while connecting to upstream, ..., upstream: "fastcgi://[::1]:9001", host: "repo.interdose.com" – BlaM Oct 27 '17 at 11:18
  • No at first I got it to work in Apache and then I switched to Grack. Hope this helps you out – gigha Oct 28 '17 at 12:35

1 Answers1

0

Check if nginx can write files into folder containing git repo. Nginx runs as user www-data:www-data, so these files may have permission like files below:

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