Version 2 of Multiple Fossil Repositories as CGI at Apache2

Updated 2018-08-10 15:06:12 by ALX

ALX 2018-08-09

Apache2 Configuration

<VirtualHost *:80 [::]:80>
   ServerName host.domain.tld
   Redirect permanent / https://host.domain.tld/
</VirtualHost>

<IfModule mod_ssl.c>
    <VirtualHost *:443 [::]:443>
        ServerName host.domain.tld
        DocumentRoot /srv/www/htdocs/domain.tld/host

        <Directory /srv/www/htdocs/domain.tld/host>
            Options -Indexes
            DirectoryIndex index.html

            RewriteEngine On
            RewriteRule ^fossil/(.*) /fossil/$1 [L]

            Require all granted
        </Directory>

        ScriptAlias /repos/ /srv/www/htdocs/domain.tld/host/repos/

        <Directory /srv/www/htdocs/domain.tld/host/repos>
            Options +ExecCGI
            SetHandler cgi-script

            RewriteEngine On
            RewriteRule !^fossil/ / [R=301,L]

            Require all granted
        </Directory>

        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/host.domain.tld/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/host.domain.tld/privkey.pem
    </VirtualHost>
</IfModule>

CGI File /srv/www/htdocs/domain.tld/host/repos/fossil

#!/usr/local/bin/fossil
directory: /srv/fossil

HTML file /srv/www/htdocs/domain.tld/host/index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Fossil Repositories</title>
  </head>
  <body>
    <h3>Fossil Repositories</h3>
    <p><a href="/repos/fossil/test1">Test Repository 1</a></p>
    <p><a href="/repos/fossil/test2">Test Repository 2</a></p>
    <p><a href="/repos/fossil/test3">Test Repository 3</a></p>
  </body>
</html>

Your repositories are here

/srv/fossil/test1.fossil
/srv/fossil/test2.fossil
/srv/fossil/test3.fossil