Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using haproxy and nginx. Haproxy has sthis option to check health of my backends:

option httpchk HEAD /lol.txt HTTP/1.0

All works fine, but I do not want to log this health check

So in my nginx configuration I add:

    location /lol.txt {
    access_log off;

The problem is, this location returns a 301, so I got these logs again and again: - - [15/Mar/2013:06:51:36 +0100] "HEAD /lol.txt HTTP/1.0" 301 0 "-" "-"

Have you some idea to have the access_log off working?


share|improve this question
There's no rewrite directive in that location block, so it can't be being used. Please provide the rest of your configuration. – mgorven Mar 15 '13 at 20:00

You probably have some other location that handles the request, and your access_log doesn't apply, or maybe it gets overwritten by another access_log directive.

Try the following if you want to disable passing these requests to the backend:

location = /lol.txt {
    access_log off;
    return 'It works!' 200;

Or, alternatively, if you still must pass the request to be backend:

if ($request_uri = /lol.txt) {
    access_log off;

It might also help to try to make sure that these access_log off appear after any other access_log directives, e.g. see if moving it around makes a difference.

Hope it helps, and please report what worked!

share|improve this answer

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.