hi, this post is mostly for myself so i can set this up quickly if i need to reinstall my vps.

my vps runs ubuntu 20.04 so i’m going to use apt to install cgit:

sudo apt install cgit fcgiwrap

next i’m going to set up the nginx config. apt’s copy of cgit places the .cgi script in /usr/lib/cgit, and the rest of the cgit files in /usr/share/cgit. change the file locations to match your copy.

server {
    listen 80;
    listen [::]:80;
    server_name git.lily.toys;
    root /usr/share/cgit;

    location / {
            try_files $uri @cgit;

    location @cgit {
               fastcgi_pass unix:/var/run/fcgiwrap.socket;
               fastcgi_param SCRIPT_FILENAME /usr/lib/cgit.cgi;
               fastcgi_param SCRIPT_NAME /;
               fastcgi_param PATH_INFO $uri;
               fastcgi_param QUERY_STRING $query_string;
               fastcgi_param REQUEST_METHOD $request_method;
               fastcgi_param CONTENT_TYPE $content_type;
               fastcgi_param CONTENT_LENGTH $content_length;
               fastcgi_param HTTPS $https if_not_empty;
               fastcgi_param SERVER_PORT $server_port;
               fastcgi_param SERVER_NAME $server_name;

and last, my /etc/cgitrc:

snapshots=tar.gz zip

root-desc="paws on keyboard"

05 sep 2020 - neko