Install and Configure Gitweb on Ubuntu 14.04

Install Gitweb

sudo apt-get install -y gitweb

Configure Gitweb

  • Enable the Apache HTTP Server cgi module.
    sudo a2enmod cgi
  • Copy the Gitweb Apache HTTP Server configuration file into /etc/apache2/conf-available/.
    sudo cp /etc/apache2/conf.d/gitweb /etc/apache2/conf-available/gitweb.conf
  • Edit the Gitweb Apache HTTP Server configuration file.
    sudo nano /etc/apache2/conf-available/gitweb.conf
    • Remove the default alias.
      • Replace
        Alias /gitweb /usr/share/gitweb
      • With
        #Alias /gitweb /usr/share/gitweb
    • Fix a syntax error.
      • Replace
        Options FollowSymLinks +ExecCGI
      • With
        Options +FollowSymLinks +ExecCGI
    • Allow authenticated users access from anywhere and protect Gitweb via basic Apache HTTP Server authentication.
      • Add
        Order allow,deny
        Allow from all

        # Authentication
        AuthType Basic
        AuthName "{DOMAIN}"
        AuthUserFile /var/www/.htpasswd
        Require valid-user
      • Above
        </Directory>
  • Enable the Gitweb Apache HTTP Server configuration file.
    sudo a2enconf gitweb
  • Edit the Apache HTTP Server default-ssl VirtualHost file.
    sudo nano /etc/apache2/sites-available/default-ssl.conf
    • Add an alias for Gitweb.
      • Add
        # Create an alias for Gitweb.
        Alias /gitweb /usr/share/gitweb
      • Above
        #    SSL Engine Switch:
  • Restart the Apache HTTP Server service.
    sudo service apache2 restart

Open Source Software:

Operating System: