From 8a2c7493d67f557d3dacf3f31f199d8a57b65d70 Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Thu, 16 Jul 2026 11:27:11 -0700 Subject: [PATCH] GitWeb --- provisioning/gitweb.conf | 33 +++++++++++++++++++++++++++++++++ provisioning/nginx_siteconf | 7 ++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 provisioning/gitweb.conf diff --git a/provisioning/gitweb.conf b/provisioning/gitweb.conf new file mode 100644 index 0000000..5909e33 --- /dev/null +++ b/provisioning/gitweb.conf @@ -0,0 +1,33 @@ +# path to git projects (.git) +$projectroot = "/home/blogmistress/gitweb-projects"; + +# directory to use for temp files +$git_temp = "/tmp"; + +# target of the home link on top of all pages +#$home_link = $my_uri || "/"; + +# html text to include at home page +#$home_text = "indextext.html"; + +# file with project list; by default, simply scan the projectroot dir. +#$projects_list = $projectroot; + +# Absolute (not relative) paths, and under /blog/gitweb-static rather than +# gitweb's default "static/..." -- gitweb here uses query-string URLs +# (?p=repo.git;a=summary), not PATH_INFO style, so it never emits a to fix up relative resolution. A relative "static/gitweb.css" +# resolves against the current page's own path (e.g. /blog/source/), landing +# on /blog/source/static/gitweb.css, which nginx routes into the gitweb.cgi +# fastcgi handler (there's no location more specific than /blog/source), and +# gitweb silently ignores the bogus extra path and re-renders the project +# list as HTML -- so the "stylesheet" comes back as text/html and never +# applies. Absolute paths sidestep this regardless of gitweb's URL style. +@stylesheets = ("/blog/gitweb-static/gitweb.css"); +$javascript = "/blog/gitweb-static/gitweb.js"; +$logo = "/blog/gitweb-static/git-logo.png"; +$favicon = "/blog/gitweb-static/git-favicon.png"; + +# git-diff-tree(1) options to use for generated patches +#@diff_opts = ("-M"); +@diff_opts = (); diff --git a/provisioning/nginx_siteconf b/provisioning/nginx_siteconf index 3d341cd..40d95da 100644 --- a/provisioning/nginx_siteconf +++ b/provisioning/nginx_siteconf @@ -95,7 +95,12 @@ server { fastcgi_pass unix:/run/fcgiwrap.socket; } - location /blog/static { # gitweb static files + # gitweb's own CSS/JS/logo/favicon. Named gitweb-static (not the + # generic-sounding static) so it can't be mistaken for a general + # blog static-asset path; gitweb.conf (see provisioning/gitweb.conf) + # points @stylesheets/$javascript/$logo/$favicon at this path + # absolutely, rather than relying on gitweb's relative default. + location /blog/gitweb-static { alias /usr/share/gitweb/static/; try_files $uri $uri/ =404; } -- 2.53.0