deny in http {}, get 500 response , how to log this?
meteor8488
nginx-forum at forum.nginx.org
Mon Mar 28 07:54:40 UTC 2016
Hi All,
I'm using deny to deny some IPs for my server.
http {
deny 192.168.1.123; # this is an example
server {
error_page 403 /error/403.htm;
error_page 404 /error/404.htm;
error_page 502 /error/502.htm;
error_page 503 /error/503.htm;
location = /error/403.htm {
index 403.htm;
access_log /var/log/403.log main;
}
location ~* ^/(data|image)/.*.(php|php5)$ {
deny all;
}
}
I found that if 192.168.1.123 access my server, due to this ip is blocked in
http {}, so it will get a 500 response.
And if someone (IP not blocked) try to access my data/*.php, he will get a
403 response.
And all these 500 and 403 response will be put into my 403.log.
Is it possible to put 500 response to a separate log? Then my 403 log will
only log these who is trying to access the protected files.
I understand that if I put "deny IP" in to server {}, it will get a 403
response. But I want to deny some IPs on the whole server level.
Thanks
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,265680,265680#msg-265680
More information about the nginx
mailing list