Apache Virtual Host -- subdomain for cgit

1.8k views Asked by At

I struggle with apache's virtual host configuration. I want to deploy cgit on a subdomain like: http://cgit.mydomain.com

I have used this as a template for my configuration: http://hjemli.net/pipermail/cgit/2011-July/000235.html Here is my virtual host configuration:

<VirtualHost *>
    ServerAdmin [email protected]
    ServerName cgit.mydomain.org
    ErrorLog "/var/log/httpd/cgit-error_log"
    CustomLog "/var/log/httpd/cgit-access_log" common
    DocumentRoot "/usr/share/webapps/cgit/"

    <Directory "/usr/share/webapps/cgit/">
        AllowOverride None
        Options ExecCGI FollowSymlinks
        Order allow,deny
        Allow from all
    </Directory>

    Alias /cgit.css "/usr/share/webapps/cgit/cgit.css"
    Alias /cgit.png "/usr/share/webapps/cgit/cgit.png"
    Alias /favicon.ico "/usr/share/webapps/cgit/favicon.ico"
    ScriptAlias / "/usr/share/webapps/cgit/cgit.cgi/"
</VirtualHost>

Here is a part of my cgitrc:

css=/cgit.css
logo=/cgit.png
favicon=/favicon.ico

Everything works fine but the css file and the favicon do not work, so the cgit webpage is broken. When I go to the URL http://cgit.mydomain.com/cgit.css cgit tells me that there is no repo called cgit.css. Usually I shoud see the cgit.css file in my browser.

A possible solution is to use /cgit/ as a script alias but I do not want to have the /cgit/ fragment in my URLs. On http://cgit.osmocom.org it works right.

1

There are 1 answers

0
rumpelsepp On BEST ANSWER

I am note really shure why but now the setup works! After adding DocumentRoot "/usr/share/webapps/cgit/" to my virtual host I stopped working yesterday. Today I looked on my cgit website and everything is fine! I think it was something like a cache issue...

The virtual host settings above work.