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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -