Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following location block in nginx:

location /stats {
  allow 127.0.0.1;
  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?

Thanks.

share|improve this question
add comment

1 Answer 1

You need to specify location 'beginning with':

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

Your Answer

 
discard

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.