Saturday 23 November 2024 Cgit with OpenBSD httpd and slowcgi on FreeBSD ============================================== Sentimental journey ------------------- Visiting old repo's is a great way to embark on a sentimental journey. In the past, I used GitWeb to browse my Git repo's. Recently I installed OpenBSD httpd with slowcgi in a FreeBSD jail [1]. It didn't require much effort to add Cgit to it. In my setup Cgit is only accessible in my local home network. I use it as a convenient way to browse through my own repo's. httpd configuration ------------------- Just one extra line in /usr/local/etc/obhttpd.conf was enough: ... location "/cgi-bin/*" { fastcgi socket "/run/slowcgi.sock" fastcgi param CGIT_CONFIG "/conf/cgit.conf" root "/" } ... The line starting with "fastcgi param" sets the environment variable CGIT_CONFIG, pointing to the Cgit configuration file. Remember that this is within the chroot, so the real path is something like /var/www/conf/cgit.conf Cgit configuration ------------------ The example cgit configuration file is very informative. Two settings that might be helpful: virtual-root=/cgi-bin/cgit.cgi/ In the listing of the repo's, cgit adds this path before the repo-name. F.e., the link to the repo 'my-stuff.git' becomes /cgi-bin/cgit.cgi/my-stuff.git scan-path=/projects This path points to the directory with the repo's. Again, this is within the chroot. In this example the real path is: /var/www/projects Read permissions for user www ----------------------------- When you don't do any fancy stuff and Cgit is only used to read the repo's, it is enough that the user www has read permissions in the scan-path and all the repo's below it. The repo's can be owned by any user. As long as the repo's are world readable, Cgit can show their contents. Static files ------------ The files cgit.css and cgit.png are to be placed in the web root, like /var/www/htdocs/ Cgit requires a footer file, e.g., cgit.footer. The location of this file is set in the Cgit configuration file. It is great fun --and sometimes embarrassing-- to walk through the old repositories. Happy Cgit-ing! [1]: gopher://box.matto.nl/0/openbsd-httpd-with-cgi-on-freebsd.txt Last edited: $Date: 2024/11/23 11:10:08 $