sub domains with /etc/hosts and apache for gitorious

Posted by QLands on Server Fault See other posts from Server Fault or by QLands
Published on 2011-06-29T12:12:12Z Indexed on 2011/06/29 16:24 UTC
Read the original article Hit count: 282

I managed to have a local install of Gitorious. Now I need to finalize the apache integration using a virtual server but nothing seems to work. See for example my /etc/hosts file:

127.0.0.1           localhost
172.26.17.70        darkstar.ilri.org darkstar
172.26.17.70        git.darkstar.ilri.org

My vhosts.conf has the following entries:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost *:80>
    <Directory /srv/httpd/htdocs>

    Options Indexes FollowSymLinks ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

    ServerName darkstar.ilri.org
    DocumentRoot /srv/httpd/htdocs
    ErrorLog /var/log/httpd/error_log
    AddHandler cgi-script .cgi

</VirtualHost>

<VirtualHost *:80>
    <Directory /srv/httpd/git.darkstar.ilri.org/gitorious/public>
        Options FollowSymLinks ExecCGI
        AllowOverride None
        Order allow,deny
        Allow from All
    </Directory>

    AddHandler cgi-script .cgi
    DocumentRoot /srv/httpd/git.darkstar.ilri.org/gitorious/public
    ServerName git.darkstar.ilri.org

    ErrorLog /var/www/git.darkstar.ilri.org/log/error.log
    CustomLog /var/www/git.darkstar.ilri.org/log/access.log combined

    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
        ExpiresActive On
        ExpiresDefault "access plus 1 year"
    </FilesMatch>

    FileETag None

    RewriteEngine On

    RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
    RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    RewriteRule ^.*$ /system/maintenance.html [L]
</VirtualHost>

Now, when I go with Firefox to darkstar.ilri.org it shows the default Apache screen: "It works!". but when I go to git.darkstar.ilri.org it waits for few seconds then falls to darkstar.ilri.org and the default apache page. No error is reported. If I run httpd -S I get:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server darkstar.ilri.org (/etc/httpd/extra/httpd-vhosts.conf:21)
         port 80 namevhost darkstar.ilri.org (/etc/httpd/extra/httpd-vhosts.conf:21)
         port 80 namevhost git.darkstar.ilri.org (/etc/httpd/extra/httpd-vhosts.conf:37)
Syntax OK

The funny thing is that if I configure gotirious in a host called gitrepository, add 127.0.0.1 gitrepository and go with Firefox to gitrepository.. Gitorious works... But why not with git.darkstar.ilri.org?

Many thanks in advance.

© Server Fault or respective owner

Related posts about apache

Related posts about virtualhosts