An attempt to host HG via Apache.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/deb/apache-register-hg.bash Sun May 07 11:16:52 2023 +0300
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -x
+
+mkdir -p /srv/hg
+chown user:user /srv/hg
+
+cat <<EOF >/srv/hg/hgweb.cgi
+#!/usr/bin/env python
+# See also https://mercurial-scm.org/wiki/PublishingRepositories
+
+# Path to repo or hgweb config to serve (see 'hg help hgweb')
+config = "/srv/hg/hgweb.config"
+
+from mercurial import demandimport; demandimport.enable()
+from mercurial.hgweb import hgweb, wsgicgi
+application = hgweb(config)
+wsgicgi.launch(application)
+EOF
+chmod a+xr /srv/hg/hgweb.cgi
+
+cat <<EOF >/srv/hg/hgweb.config
+[paths]
+/ = /srv/hg/*
+
+[web]
+style = gitweb
+encoding = "UTF-8"
+
+baseurl = /
+
+deny_push = *
+allow_archive = bz2, gz, zip
+EOF
+chmod a+r /srv/hg/hgweb.config
+
+cat <<EOF >/etc/apache2/sites-available/hg.conf
+<VirtualHost hg.defun.work:*>
+ DocumentRoot /srv/hg
+
+ ScriptAliasMatch ^/(.*) /srv/hg/hgweb.cgi$1
+
+ <Directory "/srv/hg/">
+ Options ExecCGI FollowSymLinks
+ Require all granted
+ AllowOverride None
+ </Directory>
+</VirtualHost>
+EOF
+
+a2ensite hg
+# service apache2 restart