This location
location = /favicon.ico {
include caching.conf;
}
With this in caching.conf
location ~ \.(jpg|png|jar|js|xml|css|sha1|md5|txt|pom|ogg|gif|mp3|base64|ico|zip|gz|kmz|bz2|sdf|JPG|pdf|ods|mm|hta|flv|dsk)$ {
expires max;
}
Fails with
Testing nginx configuration: nginx: [emerg] location "\.(jpg|png|jar|js|xml|css|sha1|md5|txt|pom|ogg|gif|mp3|base64|ico|zip|gz|kmz|bz2|sdf|JPG|pdf|ods|mm|hta|flv|dsk)$" cannot be inside the exact location "/favicon.ico" in /etc/nginx/caching.conf:5
To enable this, you could merge location hierarchies. In this case, the regular expression in the second location matches on the first one so the entire rule
location = /favicon.ico {
location ~ \.(jpg|png|jar|js|xml|css|sha1|md5|txt|pom|ogg|gif|mp3|base64|ico|zip|gz|kmz|bz2|sdf|JPG|pdf|ods|mm|hta|flv|dsk)$ {
expires max;
}
}
essentially becomes
location = /favicon.ico {
expires max;
}