Welcome! Log In Create A New Profile

Advanced

Location block to `deny all` for all files of `.abc` extension in `/def/` & any subdirectory

July 21, 2024 09:05AM
Hello.

I'm trying (and failing) to write a `location` block to deny access to all files with extension `.abc` in the directory `/def/` and any (wildcard) subdirectory of `/def/`. I would be very grateful for some guidance and further reading.

For clarity, this `location` block is the first in the `server`, so there are no conflicts from a previous block. I have the `/def/` block scaffold, and the `.abc` block scaffold, but I am falling down on the regex glue that connects them.

My `/def/` block looks like this:

location ^~ /.well-known/ {
[…]
}

My `.abc` block looks like this:

location ~ ^.+\.abc?$ {
[…]
}

How can I merge those into a single block so that the `location` fires correctly for `*.abc` in `/def/` and any wildcard subdirectories of `/def/`?

Thank you for reading this far, and best wishes to you.
Subject Author Posted

Location block to `deny all` for all files of `.abc` extension in `/def/` & any subdirectory

petecooper July 21, 2024 09:05AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 259
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready