1

The background : - Lighttpd 1.4.28 - Debian 6.0.7 i686

Several developers are using this web server, and each of them has his own virtual host named after "username.mysite.tld". These hosts are working fine, and I'd like to make a generic rule for the "server.errorfile-prefix" directive.

In lighttpd.conf, I have :

$HTTP["host"] =~ "user1.mysite.tld" {
    server.errorfile-prefix = "/home/user1/www/cache_html/error-"
    }
$HTTP["host"] =~ "user2.mysite.tld" {
    server.errorfile-prefix = "/home/user2/www/cache_html/error-"
    }
$HTTP["host"] =~ "user3.mysite.tld" {
    server.errorfile-prefix = "/home/user3/www/cache_html/error-"
    }

The files /home/userX/www/cache_html/error-404.html exist.

I'd like to replace this copy-paste with :

var.users="user1|user2|user3"
$HTTP["host"] =~ "^(" + users + ")\.mysite\.tld(:[0-9]+)?$" {
    server.errorfile-prefix = "/home/%1/www/cache_html/error-"
    }

But this doesn't work : the user-specific 404 pages are not found (how ironic ! ;-)

But if I try :

var.users="user1|user2|user3"
$HTTP["host"] =~ "^(" + users + ")\.mysite\.tld(:[0-9]+)?$" {
    server.errorfile-prefix = "/home/user1/www/cache_html/error-"
    }

Then, user1's own 404 page is served for all users. So it looks like something's wrong with my regex and "%1" in the path. What am I missing ?

0

only a very small set of options takes "pattern strings"; server.errorfile-prefix does not (server.errorfile-prefix is especially designed to be very simple in the internal handling so it doesn't fail again, which is why it only supports static files).

you could try to generate the config with include_shell instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.