#####################################
### someone"s ansible provisioner ###
#####################################
# Part of: https://git.somenet.org/root/pub/somesible.git
# 2017-2025 by someone <someone@somenet.org>
#
---
vhost_custom_pre_server: |-

vhost_custom: |-
    # clone via https
    location ~ ^.*\.git/(HEAD|info/refs|objects/.*|git-(upload|receive)-pack)$ {
        root /srv/gitolite/repositories/;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME   /usr/lib/git-core/git-http-backend;
        fastcgi_param PATH_INFO         $uri;
        fastcgi_param GIT_PROJECT_ROOT  /srv/gitolite/repositories/;
        fastcgi_pass unix:/run/fcgiwrap.socket;
    }

    # gitweb
    root /usr/share/gitweb;
    try_files $uri @gitweb;
    location @gitweb {
        gzip off;
        include fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME   /usr/share/gitweb/gitweb.cgi;
        fastcgi_param   PATH_INFO         $uri;
        fastcgi_param   GITWEB_CONFIG /etc/gitweb/public.conf;
        fastcgi_pass    unix:/run/fcgiwrap.socket;
    }

    # remote trailing slashes from path
    location ~ ^/(.*)/$ {
        rewrite ^/(.*)/$ /$1 permanent;
    }
