How to disable logging for illegal host headers request in nginx -
in nginx.conf, add following code deny illegal request:
server { ... ## deny illegal host headers if ($host !~* ^(www.mydomain.com|xxx.xxx.xxx.xxx)$) { return 444; } ... }
but request info written in access log, monitor request think because many , 2 unsafe site , head request.
so how stop logging these illegal request info access log?
thanks.
you should use separate server blocks
server { listen 80; # valid host names server_name www.example.com; server_name xx.xx.xx.xx; # site goes here } # requests other hostnames caught server block server { listen 80 default_server; access_log off; return 444; }
that simple , efficient
Comments
Post a Comment