I have setup nginx in my server as a reverse proxy to haproxy. I have configured my own log_format and assigned it to every virtual host I have. However I have not turned off main access_log in nginx.conf.

The majority of my website logs 99.99% go to my custom access_log file, but some logs are making their way to main access_log file defined nowhere but in nginx.conf.

Why is this happening? What is so special about these request that do not get caught by our virtual hosts' access_log?

Thanks a lot

  • 1
    What is happening? What is your configuration? – Michael Hampton Apr 3 '13 at 20:42
  • "these requests" are most likely handled by a location block where access_log is not specifically set. This may happen due to internal rewrites (e.g. to internal locations) because logging is done at the very end of request processing (after rewriting, content serving etc.). – Lukas Apr 4 '13 at 6:25

Most likely, it requests without Host: in HTTP header. So they don't "fall" into any virtualhost section of config.

| improve this answer | |
  • access_log directives are declared in server sections so every location should use these directives. Also it seems that they are directed to virtual hosts by not specifying the http header. However, the virtual hosts listen to specific IPs, so these requests may point directly to the external IPs and not using DNS names, thus falling into the default virtual host of every IP. I will continue to investigate the issue and keep you updated. Thanks for your help! – kosfar Apr 27 '13 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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