Lighttpd with FastCGI configuration running ViewVC - rewrite problems

Posted by 0xC0000022L on Server Fault See other posts from Server Fault or by 0xC0000022L
Published on 2012-09-24T09:35:41Z Indexed on 2012/09/24 9:39 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

At the moment I am struggling with the configuration of lighttpd together with ViewVC. The configuration was ported from Apache 2.2.x, which is still running on the machine, serving the WebDAV/SVN stuff, being proxied through.

Now, the problem I am having appears to be with the rewrite rules and I'm not really sure what I am missing here. Here's my configuration (slightly condensed to keep it concise):

var.hgwebfcgi                        = "/var/www/vcs/bin/hgweb.fcgi"
var.viewvcfcgi                       = "/var/www/vcs/bin/wsgi/viewvc.fcgi"
var.viewvcstatic                     = "/var/www/vcs/templates/docroot"
var.vcs_errorlog                     = "/var/log/lighttpd/error.log"
var.vcs_accesslog                    = "/var/log/lighttpd/access.log"

$HTTP["host"] =~ "domain.tld" {
    $SERVER["socket"] == ":443" {
        protocol                     = "https://"
        ssl.engine                   = "enable"
        ssl.pemfile                  = "/etc/lighttpd/ssl/..."
        ssl.ca-file                  = "/etc/lighttpd/ssl/..."
        ssl.use-sslv2                = "disable"
        setenv.add-environment       = ( "HTTPS" => "on" )
        url.rewrite-once            += ("^/mercurial$" => "/mercurial/" )
        url.rewrite-once            += ("^/$" => "/viewvc.fcgi" )
        alias.url                   += ( "/viewvc-static" => var.viewvcstatic )
        alias.url                   += ( "/robots.txt" => var.robots )
        alias.url                   += ( "/favicon.ico" => var.favicon )
        alias.url                   += ( "/mercurial" => var.hgwebfcgi )
        alias.url                   += ( "/viewvc.fcgi" => var.viewvcfcgi )
        $HTTP["url"] =~ "^/mercurial" {
            fastcgi.server += (
                ".fcgi" => ( (
                    "bin-path"      => var.hgwebfcgi,
                    "socket"        => "/tmp/hgwebdir.sock",
                    "min-procs"     => 1,
                    "max-procs"     => 5
                ) )
            )
        } else $HTTP["url"] =~ "^/viewvc\.fcgi" {
            fastcgi.server += (
                ".fcgi" => ( (
                    "bin-path"      => var.viewvcfcgi,
                    "socket"        => "/tmp/viewvc.sock",
                    "min-procs"     => 1,
                    "max-procs"     => 5
                ) )
            )
        }
        expire.url                   = ( "/viewvc-static" => "access plus 60 days" )
        server.errorlog              = var.vcs_errorlog
        accesslog.filename           = var.vcs_accesslog
    }
}

Now, when I access the domain.tld, I correctly see the index of the repositories. However, when I look at the links for each respective repository (or click them, for that matter), it's of the form https://domain.tld/viewvc.fcgi/reponame instead of the intended https://domain.tld/reponame.

What do I have to change/add to achieve this? Do I have to "abuse" the index file mechanism somehow? Goal is to keep the /mercurial alias functional.

So far I've tried sifting through the lighttpd book from Packt again, also through the lighttpd documentation, but found nothing that seemed to match the problem.

© Server Fault or respective owner

Related posts about rewrite

Related posts about lighttpd