help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set up cgit with git-http-backend properly


From: Simon Streit
Subject: Re: Set up cgit with git-http-backend properly
Date: Mon, 04 Jul 2022 12:29:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hello Florian,

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:

> what did you base your setup on?

I've been trying to figure it out from the manual and could have found a
config snippet months ago while setting it up.  It has not worked as
expected since.

> with uri-path "/git".  I think you want "/" though because you have
> its own domain.  Or maybe you want "".

To keep things simple I'm only trying to get it working with
‘git-http-nginx-location-configuration’ now.  So far it appears that it
only works when ‘uri-path’ is anything else than "" or "/".

Looking at the service definition in ‘gnu/services/version-contro.scm’
"" and "/" are the same the output of nginx' config file.  After
modifying

(string-append "~ /" (string-trim-both uri-path #\/) "(/.*)")

to

(string-append "~ " (string-trim-both uri-path #\/) "(/.*)")

serving and cloning from https://git.example.com/repo(.git) works now.
But it doesn't when cgit is enabled and serving repositories in the same
path at the same time.

Good news is that I'm at a step further now and have it working with:

(nginx-server-configuration
 (server-name '("git.example.com"))
 (root cgit)
 (try-files (list "$uri" "@cgit"))
 (locations
  (list
   (nginx-location-configuration
    (uri "@cgit")
    (body '("fastcgi_param SCRIPT_FILENAME $document_root/lib/cgit/cgit.cgi;"
            "fastcgi_param PATH_INFO $uri;"
            "fastcgi_param QUERY_STRING $args;"
            "fastcgi_param HTTP_HOST $server_name;"
            "fastcgi_pass 127.0.0.1:9000;")))
   (git-http-nginx-location-configuration
    (git-http-configuration))
   (nginx-location-configuration (uri "/.well-known")
                                 (body '("root /var/www;")))))
 (ssl-certificate "/etc/letsencrypt/live/example.com/fullchain.pem")
 (ssl-certificate-key "/etc/letsencrypt/live/example.com/privkey.pem"))

Though I still rather not keep the URL at
‘http://git.example.com/git/REPO(.git)’ for cloning.

Is there maybe another way around this?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]