简体   繁体   中英

Apache Virtual Host — subdomain for cgit

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 admin@mydomain.org
    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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM