Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following location block in nginx:

location /stats {
  deny all;

If I try and view /stats from my home MacBook I get 403 Forbidden as expected. However, if I view /stats/index.php I am able to view it. I was under the impression the location /stats would apply recursively (i.e. to all children).

How do I make this location block behave as expected?


share|improve this question

1 Answer 1

You need to specify location 'beginning with':

location ^~ /stats {
  deny all;
share|improve this answer
You were faster :) – Christopher Perrin Jul 16 '12 at 22:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.