Create sub.conf.tpl

This commit is contained in:
midoks
2022-12-10 19:54:17 +08:00
parent 315ba990ec
commit 82da5c2649
+16
View File
@@ -0,0 +1,16 @@
location / {
set $replace 'tmplate_replace';
set $spider_request '0';
if ($http_user_agent ~* '(baiduspider|360sipder|Sogou Orion spider|Sogou News Spider|Sogou blog|Sogou spider2|Sogou inst spider|Sogou web spider|Sogou spider|trendiction|Yahoo|semrush|Toutiao|Google|qihoobot|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|MSNBot|ia_archiver|Tomato Bot)') {
set $spider_request '1';
}
if ($spider_request = '0' ) {
set $replace 'tmplate_replace';
}
sub_filter 'tmplate_replace' $replace;
sub_filter_once on;
sub_filter_types *;
}