Service Outage: Please note that all services and subdomains on will be unavailable for a few days.

Self-Hosting Gitweb via Nginx

219 words; 2 minute(s)

Table of Contents


GitWeb is a simple web-based visualizer for git repositories. By default, GitWeb will only run with the lighttpd or webrick web servers.

However, this guide will show you how to keep GitWeb running in the background and display information for all repositories in a chosen directory.

See below for the final result:


Install Dependencies

To start, you'll need install the following packages:

sudo apt install git gitweb fcgiwrap nginx

Configure Nginx

Once installed, create an Nginx configuration file.

sudo nano /etc/nginx/sites-available/
server {
        listen 80;

        location /index.cgi {
                root /usr/share/gitweb/;
                include fastcgi_params;
                gzip off;
                fastcgi_param SCRIPT_NAME $uri;
                fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
                fastcgi_pass  unix:/var/run/fcgiwrap.socket;

        location / {
                root /usr/share/gitweb/;
                index index.cgi;

To make the configuration active, you need to symlink it and then restart Nginx.

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

The GitWeb application should now be available via the URL you set in the Nginx configuration above.

Customize GitWeb

If you need to, you can customize many things about Gitweb by editing the gitweb.conf file.

sudo nano /etc/gitweb.conf