Deny access to hidden files and directories (and their content)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Deny access to hidden files and directories (and their content)

nginx mailing list
I believe my current rexexp match isn’t proper because it’s missing an anchor from the pattern:

location ~ /\. {
        deny all;
}

What would be more appropriate? Would this work?

location ~ /\..*$

--
Palvelin.fi Hostmaster
[hidden email]

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Deny access to hidden files and directories (and their content)

Maxim Dounin
Hello!

On Wed, Sep 19, 2018 at 11:25:49AM +0300, Palvelin Postmaster via nginx wrote:

> I believe my current rexexp match isn’t proper because it’s missing an anchor from the pattern:
>
> location ~ /\. {
> deny all;
> }
>
> What would be more appropriate? Would this work?
>
> location ~ /\..*$

There is no real difference between these two patterns, as ".*$"
in the later one matches any characters till the line end, and
hence won't make any difference compared to "/\." matched anywhere
in the string.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx