简体   繁体   English

Apache虚拟主机-cgit的子域

[英]Apache Virtual Host — subdomain for cgit

I struggle with apache's virtual host configuration. 我对apache的虚拟主机配置感到困惑。 I want to deploy cgit on a subdomain like: http://cgit.mydomain.com 我想在以下子域上部署cgithttp : cgit

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: 我已将其用作配置模板: http : //hjemli.net/pipermail/cgit/2011-July/000235.html这是我的虚拟主机配置:

<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 : 这是我的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. 一切正常,但css文件和收藏夹图标不起作用,因此cgit网页损坏了。 When I go to the URL http://cgit.mydomain.com/cgit.css cgit tells me that there is no repo called cgit.css . 当我转到URL http://cgit.mydomain.com/cgit.css时, cgit告诉我没有名为cgit.css Usually I shoud see the cgit.css file in my browser. 通常我应该在浏览器中看到cgit.css文件。

A possible solution is to use /cgit/ as a script alias but I do not want to have the /cgit/ fragment in my URLs. 可能的解决方案是使用/cgit/作为脚本别名,但我不想在URL中使用/cgit/片段。 On http://cgit.osmocom.org it works right. http://cgit.osmocom.org上可以正常使用。

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. DocumentRoot "/usr/share/webapps/cgit/"到我的虚拟主机后,我昨天停止工作。 Today I looked on my cgit website and everything is fine! 今天,我查看了我的cgit网站,一切正常! I think it was something like a cache issue... 我认为这有点像缓存问题...

The virtual host settings above work. 上面的虚拟主机设置起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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