Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi and sorry for bad english first :(...

i have one ubuntu 11.10 server and i wanna make gitweb server. i refered to this site -

so, i tried to install gitweb and restart apache server.

(as root account)
$ apt-get install gitweb
$ service apache2 restart

and i tried to connect my gitweb server, but i can't connect - Internal Server Error. i was searching for a lot of time and tried to solve this problem, i coudn't.

this is my gitweb and my server infomation -

  1. installed 'mediawiki' and working now.
  2. installed 'apache2' and working too.
  3. git is working too. i tried to clone git repo to my desktop, and success connected.
  4. installed 'gitweb' and... not working. - Internal Server Error.
  5. i checked my apache2 log.

    [error] [client ---.---.---.---] (13)Permission denied: exec of '/usr/share/gitweb/index.cgi' failed
    [error] [client ---.---.---.---] Premature end of script headers: index.cgi
  6. gitweb was installed to /usr/share/gitweb.

  7. this is permission for /usr/share/gitweb forlder.

    -rwxr-xr-- 1 root root 221331 2012-05-08 02:24 gitweb.cgi
    lrwxrwxrwx 1 root root     10 2011-06-11 18:17 index.cgi -> gitweb.cgi
    drwxrwxrwx 2 root root   4096 2012-05-07 19:36 static
  8. this is result to 'perl /usr/share/index.cgi'.

    Status: 404 Not Found^M
    Content-Type: text/html; charset=utf-8^M
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
    <html xmlns="" xml:lang="en-US" lang="en-US">
    <!-- git web interface version, (C) 2005-2006, Kay Sievers <>, Christian Gierke -->
    <!-- git core binaries version -->
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="generator" content="gitweb/ git/"/>
    <meta name="robots" content="index, nofollow"/>
    <title>Untitled Git</title>
    <link rel="stylesheet" type="text/css" href="static/gitweb.css"/>
    <link rel="shortcut icon" href="static/git-favicon.png" type="image/png" />
    <div class="page_header">
    <a title="git homepage" href=""><img class="logo" height="27" src="static/git-logo.png" alt="git" width="72" /></a><a href="/">projects</a> / </div>
    <div class="page_body">
    <br /><br />
    404 - No projects found
    <br />
    <div class="page_footer">
    <a class="rss_logo" href="?a=opml">OPML</a> <a class="rss_logo" href="?a=project_index">TXT</a>
    <script type="text/javascript" src="static/gitweb.js"></script>
  9. /etc/gitweb.conf

    # path to git projects (<project>.git)
    $projectroot = "/home/git/repositories";
    # directory to use for temp files
    $git_temp = "/tmp";
    # target of the home link on top of all pages
    #$home_link = $my_uri || "/";
    # html text to include at home page
    #$home_text = "indextext.html";
    # file with project list; by default, simply scan the projectroot dir.
    $projects_list = "/home/git/projects.list";
    # stylesheet to use
    @stylesheets = ("static/gitweb.css");
    # javascript code for gitweb
    $javascript = "static/gitweb.js";
    # logo to use
    $logo = "static/git-logo.png";
  10. /etc/apache2/conf.d/gitweb

    Alias /gitweb /usr/share/gitweb
    <Directory /usr/share/gitweb>
      Option FollowSymLinks +ExecCGI
      AddHandler cgi-script .cgi
  11. i excuted this command - "a2enmod cgi, a2enmod perl" and already enabled.

share|improve this question

Looks like apache can't execute index.cgi because it doesn't have permission. index.cgi is a symlink to gitweb.cgi, and I can see from it's permissions that only root can execute it.

Usually Apache doesn't run as the root user, so you need to change the permissions of gitweb.cgi to allow Apache to execute it.

Try running this command (as root) to change the permissions on gitweb.cgi

chmod +x /usr/share/gitweb/gitweb.cgi
share|improve this answer
Thanks for reply, and i did that command... but, it donesn't too :) – Kris May 8 '12 at 8:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.