Regex location has a regex pattern without ^ or $. This is a configuration style that is prone to errors. It may also lead to a situation when requests partially matching the regex pattern are incorrectly routed to this location.
Always use ^ or $ achor in a regex pattern.
If I add ^ like this location ~ /^\.(?!well-known\/) { then . (dot files) are no longer blocked and become downloadable.
How can I silence this warning without destroying the deny of access to dot files.
But I bet that would block everything. Also, what exactly are you trying to block? All dot-files? And, does “well-known” begin with a period? Be more specific about the exact path you are trying to block.
Also, why are there dotfiles on your server that you don’t want to have downloaded? Why are there any files on the server if you don’t want them to be publicly available?
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
But it resulted in the dotfiles not being blocked. A web address with a dot file path entered into the address bar causes the download box to pup up. Without the ^, its denied correctly, but the syntax warning.
I ended up ignoring this warning because I’ve seen Nginx team themselves ignore it in some of the configs they offer online. Thanks for the help. It’s been nice to dig into Nginx a little.