1

I?m trying to setup CGit and NGINX. I'm almost there but I have a problem with the rewrite rule in my NGINX's conf file.

Currently I have this:

server {
    listen       80;
    server_name  cgit.mydomain.com;
    index cgit.cgi;
    gzip off;

    root /usr/share/webapps/cgit;

    include fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME $document_root/cgit.cgi;

    location / {
        try_files $uri @cgit;
    }

    location @cgit {
        auth_basic "Restricted";
        auth_basic_user_file /path/to/my/password_file;

        gzip off;
        rewrite ^/([^/]+/.*)?$ /cgit.cgi?url=$1 break;
        fastcgi_pass    fcgiwrap;
    }
}

I understand that the URL when I'm looking at demo_repo_1.git should look like http://cgit.mydomain.com/cgit.cgi?url=gitolite-admin.git (or something similar?) but instead it looks like http://cgit.mydomain.com/cgit.cgi/gitolite-admin.git/, and it doesn't work (as in cgit.cgi script can't read the correct data from the URL and can't show the right information about my repos.

Also, if I force the URL that I think it should be (copy&paste the "right" URL in my browser) the cgit.cgi script gets downloaded.

Can I get some help with that rewrite rule, please?

alexandernst
  • 534
  • 3
  • 9
  • 21

0 Answers0