0
votes

I have a location block at / (root) level and a location block at a particular folder level such as /some-folder In the location block for some-folder, i have added a custom header, so that i can determine if nginx is activating that block. When i make a call to a resource such as /some-folder/a.html, i can see custom header coming back, but the try_files $uri $uri/ =404; returning me 404 for a.html

If i comment the location block for /some-folder and just leave the root block and then make a call again to /some-folder/a.html, nginx happily serves the file.

I am confused why root block is able to serve the file, and why /some-folder location block fails, even though it is being activated as i get 404 back with my custom header.

1
Probably root is not correctly defined for that location.Richard Smith
Thats what i initially thought... but it is a simply copy paste from / location that works fine..Jimm
We would need to see the contents of the server block to understand what's happening.Richard Smith
@RichardSmith Just trying to understand how server block impacts location block in this case? As i mentioned that location block is being activated, but i am getting 404Jimm

1 Answers

0
votes

As mentioned by @RichardSmith, the root was not pointing to correct location. It had a typo.