Hi,
I have this rule in my nginx config file
location ~* \/(fileA.txt|fileB.txt)$ {
return 404 'nothing here';
}
but it's not working
but
location /fileA.txt {
return 404 'nothing here';
}
is working....
Any idea what's wrong ?
Thanks.
Hi,
I have this rule in my nginx config file
location ~* \/(fileA.txt|fileB.txt)$ {
return 404 'nothing here';
}
but it's not working
but
location /fileA.txt {
return 404 'nothing here';
}
is working....
Any idea what's wrong ?
Thanks.
11 Comments
elbucho@lemmy.world · 2 pts · 359d
You aren't escaping your periods. Try like this:
Rick_C137@programming.dev · 1 pts · 359d
Thanks @elbucho@lemmy.world
I've tried
but still not matching :'(
30p87@feddit.org · 1 pts · 359d
.md or .txt?
Rick_C137@programming.dev · 2 pts · 359d
.md is correct, it's a test.
Rick_C137@programming.dev · 2 pts · 359d
Never mind, I understood my mistake... This nginx built didn't come with ngx_http_rewrite_module so return will not works.Rick_C137@programming.dev · 1 pts · 359d
Apparently ngx_http_rewrite_module "module" is installedby default with nginx... damn thay should use diffrent terms for what could be install or not at compile time..
x00z@lemmy.world · 2 pts · 359d
You might have another location block before it that catches the route.
ramble81@lemmy.zip · 2 pts · 359d
I ran into something similar and the docs didn’t make sense. This link helped figure things out.
Rick_C137@programming.dev · 1 pts · 353d
Thank you @ramble81@lemmy.zip 👍
Post saved !
Rick_C137@programming.dev · 1 pts · 359d
Actually I don't think the error lay in the regex.
because
Does not works either...
Rick_C137@programming.dev · 1 pts · 353d
Finally it works as it should I update my old nginx version to newest freenginx and read Thoroughly the
locationdocumentation and this post thanks to @ramble81@lemmy.zip