box.matto.nl

home/

Gitweb with Lighttpd on Debian Wheezy

Last edited

Gitweb is a webinterface to your Git repositories

Gitweb

Gitweb is a webinterface to your Git repositories. It is written in Perl and can be run as an cgi webapplication.

Lighttpd

Lighttpd is a very fast lightweight webserver.

Lighttpd is easy to configure and easy to maintain.

Configuring lighttpd on Debian Wheezy for Gitweb

Debian installs gitweb in /usr/share/gitweb.

After installing lighttpd and gitweb on your Debian box, you need to change some configuration files.

Configure Gitweb

The configuration file for Gitweb is /etc/gitweb.conf.

In this file set the projectroot to the right directory. In my setup I have all the repositories in the home directory of the user git, so the line in /etc/gitweb.conf is as follows.

$projectroot = "/home/git/";

The other lines of the gitweb config file can be left untouched.

Configure lighttpd

The configuration file for lighttpd is /etc/lighttpd/lighttpd.conf.

In this file we add a block for gitweb.

mimetype.assign += ( ".css" => "text/css" )

server.modules += ( "mod_alias", "mod_cgi", "mod_redirect", "mod_setenv" )
setenv.add-environment = ( "GITWEB_CONFIG" => "/etc/conf.d/gitweb.conf" )
url.redirect += ( "^/gitweb$" => "/gitweb/" )
alias.url += ( "/gitweb" => "/usr/share/gitweb" )
$HTTP["url"] =~ "^/gitweb/" {
       cgi.assign = ( ".cgi" => "" )
       server.indexfiles = ( "gitweb.cgi", "index.cgi" )
}

When you have copied the above block inside the lighttpd.conf file, restart lighttpd.

/etc/init.d/lighttpd restart

Now point your webbrowser to http://<ip-number-or-hostname>/gitweb/