#!/bin/bash -l
# Copyright (C) 2016 Ian Kelling
# This program is under GPL v. 3 or later, see
# lj is test server
case $HOSTNAME in
lj)
domain=iankelling.org
;;
lk)
domain=iank.bid
;;
esac
# debian has the package gitweb, which seems to mainly
# have some example apache config, and a minimal gitweb config.
# I'll just use the config as example and not use the package.
# It's example apache config seems to say we can use cgi or cgid,
# and googling cgid it seems a newer faster alternative.
s a2enmod cgid
s dd of=/etc/gitweb.conf <
# to run python scripts with cgi
Options +ExecCGI
AddHandler cgi-script .py
# All below is for gitweb + git-http-web.
# A simple builtin way to have a read only git website.
# I didn't find any significantly better alternatives out there.
SetEnv GIT_PROJECT_ROOT $gitroot
SetEnv GIT_HTTP_EXPORT_ALL
# note: cgi scripts can go anywhere into the filesystem,
# so there is no need to do a directory block for $gitroot
# fot git-http-web
AllowOverride None
Require all granted
Options +FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
# from man-git-http-backend, so git-http-web ang gitweb can both be used.
# it is instead of this:
# #ScriptAlias / /usr/lib/git-core/git-http-backend/
ScriptAliasMatch \\
"(?x)^/git/(.*/(HEAD | \\
info/refs | \\
objects/(info/[^/]+ | \\
[0-9a-f]{2}/[0-9a-f]{38} | \\
pack/pack-[0-9a-f]{40}\\.(pack|idx)) | \\
git-(upload|receive)-pack))\$" \\
/usr/lib/git-core/git-http-backend/\$1
# man-git-http-backend claims we should do this, but
# it causes no css/images to be displayed. Instead,
# just stick with the standard gitweb example directive
# from debian.
#ScriptAlias /git /usr/share/gitweb/gitweb.cgi/
Alias /git /usr/share/gitweb
EOF