Ubuntu – gitweb on Ubuntu Server as Location/Directory instead of Virtual Host

gitUbuntu

Since DynDNS no longer resolves subdomains for free I have to use gitweb on a subdir of the apache2. Usual suspects such as Pro Git suggest something like

<VirtualHost *:80>
    ServerName gitserver
    DocumentRoot /srv/gitosis/repositories/
    <Directory /srv/gitosis/repositories/>
        Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All
        order allow,deny
        Allow from all
        AddHandler cgi-script cgi
        DirectoryIndex gitweb.cgi
    </Directory>
</VirtualHost>

I tried various variations using Location and Directory tags with different attribute combinations without any notable success.

My first Idea was close to the following

Alias /gitweb /srv/gitosis/repositories
<Location /gitweb>
    AuthType Basic
    AuthName "gitweb Repository view"
    AuthUserFile /etc/apache2/gitweb.passwd
    Require valid-user
    SSLRequireSSL
    SetEnv GITWEB_CONFIG /etc/gitweb.conf
    AddHandler cgi-script cgi
    DirectoryIndex /usr/lib/cgi-bin/gitweb.cgi
</Location>

Apache is in the gitosis group, the repositories are readable and executable for that group.

So, what is the indended way to get websvn run on Ubuntu 10?

EDIT: using "git instaweb –httpd=apache2" in a repo as user gitosis works fine

Best Answer

Finally I got some solution, or at least a workaround as it doesn't seem to be very elegant. I use the existing ssl vhost with the following config:

Alias /gitweb /usr/lib/cgi-bin
Alias /gitweb.css /usr/share/gitweb/gitweb.css
Alias /git-favicon.png /usr/share/gitweb/git-favicon.png
Alias /git-logo.png /usr/share/gitweb/git-logo.png
<Directory /usr/lib/cgi-bin>
    AuthType Basic
    AuthName "Gitweb Repository View"
    AuthUserFile /etc/apache2/gitweb.passwd
    Require valid-user
    SSLRequireSSL
    Options +Indexes +ExecCGI +FollowSymLinks +MultiViews
    AddHandler cgi-script .cgi
    DirectoryIndex gitweb.cgi
    Order allow,deny
    Allow from all
</Directory>

I don't like those aliases, but at least it works without touching the cgi.