Stop Nginx from logging robots.txt, favicon.ico

I decided that I do not want to log HTTP Error 404 when browsers cannot access favicon.ico or when search engines cannot access robots.txt

Thanks to kfl62 at GitHub for this one:
https://gist.github.com/kfl62/6049099

Please note, that if your web app uses a different path for your favicons, to add the data URI:

<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> 

Now, for the code:

location = /favicon.ico {
	log_not_found off;
	access_log off;
}

location = /robots.txt {
	allow all;
	log_not_found off;
	access_log off;
}

Include this inside your server block (for each server, you have to include this again), and you will no longer receive those pesky error 404s in your logs. (This won’t prevent an error 404 from displaying on the client side in the console for favicon.ico).