Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a public nginx webserver in ec2 that gets bombarded by garbage URLs. Is there a way to configure nginx error log so that it wont log 'No such file or directory' and 'directory index of X forbidden' errors?

I don't want to change the loglevel to crit.

share|improve this question
    
Is the issue that you want a log file you can watch that doesn't have this? Or are you concerned about disk space due to the log size? –  polynomial Aug 29 '11 at 14:28
    
Both. Having a webserver on a cloud with well known ip ranges I know I'm going to get sniffers. File not found is not valuable info for me, as I can get the info from analytics. –  rynop Aug 31 '11 at 12:32

2 Answers 2

up vote 3 down vote accepted

log_not_found off disables logging "no such file/directory" messages. My advice is to set on per-location basis, for the typical locations these bad guys are sniffing.

share|improve this answer

You would probably be better off installing fail2ban and configuring an suitable set of jails for the nginx logs. This way your firewall deals with the blocking and your nginx doesn't get to deal with them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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