# Sample folder and virtual host configurations for httpd.
# edit, move it to /etc/httpd/extra and include it in
# /etc/httpd/httpd.conf with a line
#
# Include /etc/httpd/extra/cgit.conf
#
# uncomment also the line
#
# AddHandler cgi-script .cgi
#
# and enable mod_cgi (or mod_cgid, depending on your apache
# configuration)

## Version 1: cgit in a /cgit subdirectory of the main host
## This will need the following 3 lines in your /etc/cgitrc
##
## virtual-root=/cgit/
## css=/static/cgit.css
## logo=/static/cgit.png
##
#Alias /static/cgit.css "@DOCROOT@/cgi-bin/cgit.css"
#Alias /static/cgit.png "@DOCROOT@/cgi-bin/cgit.png"
#ScriptAlias /cgit/ "@DOCROOT@/cgi-bin/cgit.cgi/"
#RedirectMatch ^/cgit$ /cgit/
#<Directory "@DOCROOT@/cgi-bin/">
#   AllowOverride None
#   Options ExecCGI FollowSymlinks
#   Require all granted
#</Directory>

# Version 2: cgit as a handler to whole vhost
# Thanks to Robby Workman for this elegant example
<VirtualHost *:80>
     ServerName cgit.yourdomain.ltd
     
     Options FollowSymlinks

     SetEnv CGIT_CONFIG /etc/cgitrc

     DocumentRoot @DOCROOT@/cgi-bin

     <Directory @DOCROOT@/cgi-bin>
          AllowOverride None
          Require all granted
          DirectoryIndex cgit.cgi
     </Directory>

     Alias /cgit.css @DOCROOT@/cgi-bin/cgit.css
     Alias /cgit.png @DOCROOT@/cgi-bin/cgit.png
     Alias /favicon.ico @DOCROOT@/cgi-bin/favicon.ico
     Alias /robots.txt @DOCROOT@/cgi-bin/robots.txt
     Alias / @DOCROOT@/cgi-bin/cgit.cgi/

     <Location />
          Options ExecCGI
          Require all granted
     </Location>

     <Files cgit.cgi>
          SetHandler cgi-script
     </Files>
</VirtualHost>
