#--------------------------------------------------------
#- _ _ _ __ WikiMirror-Public -
#- / \ _ _\ \ / () / _| _ _ __ ___ _ _ -
#- / _ \ | ‘ \ V /| | \_ \ / _ \ ‘\ \ / / _ \ ‘|-
#- / _ \| | | | | | | ) | __/ | \ V / __/ | -
#-// \\| ||| || |_/ \|| \/ \|_| -
#——————————————————–
#镜像站会将源站中发送的”.wikipedia.org”字符串全部替换为”.example.com”,
#镜像站为了支持全部(将近三百个)语言分站与它们所包含的不计其数的页面与资源,不得不这么做。
#详见:https://zhwp.org/Topic:Veamsg4xywbgb6xa
#——————————————————–
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ~^(?[^.]+(\.m)?\.)?example\.com$;
add_header AnYi-Mirror-Site-public “Config modified at 2020-02-12”;
#阻止搜索引擎蜘蛛收录站点。
if ($http\_user\_agent ~* "Bot|Spider|BingPreview|Feedfetcher-Google|ia_archiver|MBCrawler|Mediapartners-Google|MSNot-media|Teoma|Yahoo! Slurp|^$") {
return 444;
}
location / {
resolver 8.8.8.8 ipv6=on;
proxy_pass https://${subdomain}wikipedia.org;
proxy\_cookie\_domain wikipedia.org example.com;
proxy_redirect https://www.wikipedia.org/ https://www.example.com/;
proxy_redirect https://${subdomain}wikipedia.org/ https://${subdomain}example.com/;
proxy_redirect https://${subdomain}m.wikipedia.org/ https://${subdomain}m.example.com/;
proxy\_set\_header Accept-Encoding "";
proxy\_set\_header Host ${subdomain}wikipedia.org;
proxy\_set\_header Referer $http_referer;
proxy\_set\_header User-Agent $http\_user\_agent;
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;
proxy\_set\_header X-Forwarded-Proto https;
proxy\_set\_header X-Real-IP $remote_addr;
sub_filter ".wikipedia.org" ".example.com";
sub\_filter\_once off;
sub\_filter\_types *;
}
}