发布时间: 2011-12-07 14:04:00
sudo apt-get install apache2 git-core gitweb sudo a2enmod rewrite
$projectroot = "/pub/git"; $git_temp = "/tmp"; #$home_link = $my_uri || "/"; $home_text = "indextext.html"; $projects_list = $projectroot; $stylesheet = "/gitweb.css"; $logo = "/git-logo.png"; $favicon = "/git-favicon.png"; # enable human readable URLs $feature{'pathinfo'}{'default'} = [1];
<VirtualHost *> ServerName git.mydomain.com ServerAlias git DocumentRoot /pub/git SetEnv GITWEB_CONFIG /etc/gitweb.conf RewriteEngine on RewriteRule ^/$ /gitweb [PT] RewriteRule ^/(.*\.git/(?!/?(HEAD|info|objects|refs)).*)?$ /gitweb%{REQUEST_URI} [L,PT] # Aliases ScriptAlias /gitweb /usr/lib/cgi-bin/gitweb.cgi Alias /gitweb.css /usr/share/gitweb/gitweb.css Alias /git-logo.png /usr/share/gitweb/git-logo.png Alias /git-favicon.png /usr/share/gitweb/git-favicon.png # Logfiles ErrorLog /var/log/apache2/gitweb.error.log CustomLog /var/log/apache2/gitweb.access.log combined </VirtualHost>
sudo a2ensite gitweb
sudo invoke-rc.d apache2 restart