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

Maxim Dounin mdounin at
Wed Sep 19 18:16:00 UTC 2018


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

More information about the nginx mailing list