Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running lighttpd 1.4.19. I have mod_auth enabled. If I do something like:

auth.require = ( "/" => (
            "method" => "digest",
            "realm" => "Authorized users only",
            "require" => "user=someuser"
            )
        )

my main website on port 80 gets auth. However, I would like to enable auth for a website running on a custom port (say 8080). I handle my custom port website with the following config:

$SERVER["socket"] == ":8080" {
        $HTTP["host"] =~ "^www.mysite.com" { 
                include "my8080site.conf"
        }
}

Can anyone help out? The auth only works for the site running on port 80.

share|improve this question

1 Answer 1

Try putting the auth.require bit inside of your server definition:

$SERVER["socket"] == ":8080" {
    auth.require = ( "/" => (
        "method" => "digest",
        "realm" => "Authorized users only",
        "require" => "user=someuser"
        )
    )
    $HTTP["host"] =~ "^www.mysite.com" { 
            include "my8080site.conf"
    }
}

This seems to work in my test setup (although I don't know if it's a fully valid test, since I don't see your entire configuration).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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