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'm trying to don't log requests made from a specific ip address like this:

location = / {
    index index.php;
    if ( $remote_addr = "spe.ci.fic.ip" )
    {
        access_log off;
    }

}

But it doesn't work, why?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You use correct syntax

location ~ ^/(css|js) {
    if ( $remote_addr = "127.0.0.1" ) 
    {
        access_log off;
    }
}

In your example nginx doesn't write logs only for '/' location.

share|improve this answer
    
I doesn't work for me :/ –  GlinesMome Mar 17 '13 at 15:55
    
I tested on nginx/1.3.6, works as expected. –  Valery Viktorovsky Mar 17 '13 at 17:15
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.