Hi,
I’m trying to do the following:
I would like to stop logging from Pingdom bots, as a checking every 5
second
pollutes the access log and it doesn’t have any meaningful value. My
problem
is that I cannot integrate it into any kind of location block.
I encountered the following errors:
- map cannot be used here
- if cannot be used here
- if needs to return something, while I don’t want to modify what to
return
except I simply want to stop logging.
Here is how I tried:
A sample server conf:
server {
listen 80;
server_name www.z-e-r-o.in;
rewrite ^/(.*) http://z-e-r-o.in/$1 permanent;
}
server {
listen 80;
server_name z-e-r-o.in zsoltero.com;
root /home/zsero/http/hosts/z-e-r-o.in;
error_log /home/zsero/http/logs/z-e-r-o.in.error.log;
access_log /home/zsero/http/logs/z-e-r-o.in.access.log;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/php.d/zsero.conf;
client_max_body_size 200M;
}
And in /etc/nginx/conf.d/*.conf there are 5 standard configurations, one
of
them being nolog.conf:
location = /robots.txt {
access_log off;
log_not_found off;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location ^~ /apple-touch-icon {
access_log off;
log_not_found off;
}
I tried methods from here:
http://fralef.me/nginx-hardening-some-good-security-practices.html
But none of them work. One reason is that they are all about returning
something, which I do not want to modify, since then Pingdom would
stop
working. The other reason is that I don’t know where to put the map
block,
since map cannot be used there is shown.
Can you tell me how to integrate non-logging of Pingdom bot into my
conf?
Also, does the conf look OK?
Posted at Nginx Forum: