Project

General

Profile

[Solved] Need help with access configuration

Added by SchneiderBernd almost 5 years ago

Hello!

Currently I am using the lighttpd server version 1.4.53 on a Debian Buster 64-Bit Linux. But this information is not important for my request.

In my local network (10.1.1.0/24), everything on my server should be accessible, but from outside only a single directory including all subdirectories (nextcloud). How do I write this in lighttpd syntax?

My attempt:

$HTTP["remoteip"] !~ "10.1.1.0/24" {
    $HTTP["url"] !~ "^/nextcloud/" {
        url.access-deny = ( "" )
    }
}

Unfortunately, all other directories from the local network are also blocked in this way.

Maybe I just have a thinking error, but I just can't get any further and somehow I'm missing the right keywords for searching. I hope someone can help me here.

Many thanks in advance!

Best regards
SchneiderBernd


Replies (2)

RE: Need help with access configuration - Added by gstrauss almost 5 years ago

Using regexes on IP addresses is fraught with peril and is frequently done incorrectly.

CIDR notation is supported in lighttpd $HTTP["remoteip"] only with == and !=
(It makes sense only with == and != since you're asking lighttpd to take the IP address and mask out bits)

$HTTP["remoteip"] != "10.1.1.0/24" {
    $HTTP["url"] !~ "^/nextcloud/" {
        url.access-deny = ( "" )
    }
}

RE: Need help with access configuration - Added by SchneiderBernd almost 5 years ago

Oh, my God. One false sign and it works!

Thank you very much :-)

Best regards
SchneiderBernd

    (1-2/2)