Is it possible to make an 'if' statement in one place of the configuration of the Nginx server, so that all available sites use this statement? I have the statement below in every sites' conf file on 'location' level. It turns down all spammy referrers so they will not show up in Google Analytics. Because there are constantly new spammers, it is constantly changing. Now I have to change every site's conf file which is a lot of work.
if ( $http_referer ~* (googlemare.com|santasgift.ml|o-o-8-o-o.com|black-friday.ga|claim381811.copyrightclaims.org|claim18181266.copyrightclaims.org|alibestsale.com|qualitymarketzone.com|floating-share-buttons.com|qualitymarketzone.com|site9.free-floating-buttons.com|chinese-amezon.com|site4.free-floating-buttons.com|hongfanji.com|site2.free-floating-buttons.com|www.event-tracking.com|site8.free-floating-buttons.com|get-free-social-traffic.com|site1.free-floating-buttons.com|satellite.maps.ilovevitaly.com|sexyali.com|sanjosestartups.com|buy-cheap-online.info|theguardlan.com|www.Get-Free-Traffic-Now.com|googlsucks.com|www1.social-buttons.com|s.click.aliexpress.com|topic152567.adviceforum.info|humanorightswatch.org|nl.wow.com|o-o-6-o-o.com|forum_thread152567.buy-forum.ru|bestwebsitesawards.com|forum.topic58847617.darodar.com|hulfingtonpost.com|priceg.com|blackhatworth.com|iloveitaly.co|buttons-for-website.com|cenoval.ru|cenokos.ru|jewelry|viagra|nude|girl|nudit|casino|poker|porn|sex|teen|babes) ) {
return 403;
}
At the very least, you can
include
configuration stanzas.This way, you only need to edit this part once and include it into every
vhostserver block.