1

I am running a git repository browser using cgit, on nginx.
Opening the index page causes a No repositories found error to be shown instead of the index. I believe it is because foo.bar/ gets handled as foo.bar/cgit, which then gets interpreted as a git repository with the name "cgit", which does not exist, hence the error. I am not sure what I am doing wrong here.

my nginx config, with irrelevant parts (e.g. ssl configs and such) removed and addresses/paths cleaned for anonymity:

server {
    listen                          80;
    server_name                     git.foo.bar;
    return                          301 https://git.foo.bar$request_uri;
}

server {
    listen                          443 ssl http2;
    server_name                     git.foo.bar;

    #
    # ssl configs here
    #

    location ~* ^.+\.(css|png|ico)$ {
            root /foo/bar/htdocs;
            expires 30d;
    }

    location / {
            include                 fastcgi_params;
            fastcgi_pass            unix:/foo/bar;
            fastcgi_index           /;

            fastcgi_param           DOCUMENT_ROOT           /foo/bar/htdocs;
            fastcgi_param           SCRIPT_FILENAME         /foo/bar/cgit.cgi;
            fastcgi_param           PATH_INFO               $uri;
            fastcgi_param           HTTP_HOST               $server_name;
    }

}

librin.so.1
  • 131
  • 5

1 Answers1

2

Adding

rewrite     /cgi    /   break;

inside the location / block solves this particular issue.

librin.so.1
  • 131
  • 5