<VirtualHost *:5081>
    UseCanonicalName off

    DocumentRoot /srv/admin/htdocs

    <Location />
        Require all granted
        Deny from 172.16.0.0/12
    </Location>

    Alias /log/ /srv/data/var/log/
    <Directory /srv/data/var/log>
        Options Indexes FollowSymLinks
        ForceType text/plain
        Header set X-Content-Type-Options nosniff
    </Directory>

    <Directory /srv/admin/htdocs>
        DirectoryIndex index-internal.php index.php
        Options Indexes FollowSymLinks
        AllowOverride None
        AddHandler proxy:unix:/srv/run/php/admin.sock|fcgi://localhost .php
    </Directory>

    # FIXME: this should not be enabled for instances other than php5
    <Location /php-status-www>
        SetHandler proxy:unix:/srv/run/php/www.sock|fcgi://localhost
    </Location>
    <Location /php-status-admin>
        SetHandler proxy:unix:/srv/run/php/admin.sock|fcgi://localhost
    </Location>
    <Location /server-status>
        SetHandler server-status
    </Location>

    <IfModule mod_info.c>
        <Location /server-info>
            SetHandler server-info
        </Location>
    </IfModule>

    <LocationMatch ^/gitweb/$>
        Redirect "/gitweb/" "/cgit/"
    </LocationMatch>

    ScriptAlias "/cgit/"    "/opt/cgit/bin/cgit.cgi/"
    Alias       "/cgit.css" "/srv/admin/htdocs/css/cgit.css"
    Alias       "/cgit.png" "/srv/admin/htdocs/images/logo_gandi.png"
    Alias       "/cgit.ico" "/srv/admin/htdocs/favicon.ico"
    <LocationMatch ^/cgit>
        Options +ExecCGI
        Require all granted
    </LocationMatch>

</VirtualHost>
