有时候,一些搜索引擎真的不能满足我们的学计算机的需求。
我们怀念谷歌还在的日子。

关于镜像站
镜像站在数据传输层面和CDN相似,都是基于反向代理,简单说客户浏览器访问镜像站,镜像站将request转发到源站,再将源站的response发送给客户。其中,request的数据包需要根据源站的要求作出改变,至少需要将host替换为源站的host。Useragent也同样需要传给源站,以便其提供适合用户客户端的网页。

但是现在你只需要知道,可以直接使用谷歌就行了233

链接地址
https://g.louqunhua.top/
http://supersearch.000webhostapp.com/

搭建:基础配置

location / {
    proxy_set_header  Host  "www.google.com.hk";
    proxy_set_header  User-Agent $http_user_agent;
    proxy_set_header  Connection "";
    proxy_http_version 1.1;
    proxy_pass https://www.google.com.hk;
}

TxtCopy
PS:使用https为搜索加密是极为重要的,否则你的域名很难长期使用,甚至可能因为搜索了某个关键词而被屏蔽。使用cdn则能够为你的镜像站做ip保护和加速。目前免费的cdn不少,cloudflare虽然速度不是特别快,但是综合体验不错。并且其“flexible”模式的https不要求你拥有ssl证书,只要域名规范即可开启。成功开启https后,建议强制使用https。

搭建:完整配置

worker_processes  1;
worker_rlimit_nofile 65536;
error_log  logs/error.log;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    charset  utf-8;
    include       mime.types;
    default_type  application/octet-stream;
    access_log  logs/access.log;
    sendfile        on;
    keepalive_timeout  65;
    gzip on;
    gzip_min_length 1k;
    gzip_buffers    4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
    gzip_vary on;
    client_max_body_size   10m;
    client_body_buffer_size   256k;
    proxy_buffer_size   64k;
    proxy_buffers   4 512k;
    proxy_busy_buffers_size   1024k;
    server {
        listen       443 ssl;
        server_name  guso.ml;
        ssl_certificate /your/dir/to/pemOrCrt;
        ssl_certificate_key /your/dir/to/key;
        access_log off;
        error_log off;

        location / {
            subs_filter 'https://maps.google.com' 'http://www.google.cn';
            subs_filter 'https:\/\/maps.google.com' 'http:\/\/www.google.cn';
            subs_filter 'translate.google.com' 'translate.google.cn';
            subs_filter_types application/json;

            # remove the line below when your server is in Amarica
            set $args "${args}&gws_rd=cr";
            proxy_cookie_domain google.com guso.ml;
            proxy_redirect https://www.google.com https://guso.ml;
            proxy_redirect http://www.google.com https://guso.ml;
            proxy_set_header  Accept-Encoding "";
            proxy_set_header  Host  "www.google.com";
            proxy_set_header  User-Agent $http_user_agent;
            proxy_set_header  Connection "";
            proxy_http_version 1.1;
            proxy_pass http://unix:/var/run/google.sock;
        }
    }

    upstream google {
        server 118.98.106.212:443;
        server 118.98.106.217:443;
        server 118.98.106.231:443;
        # add more servers here
    }

    server {
        listen unix:/var/run/google.sock;
        server_name www.google.com;
        proxy_set_header Accept-Encoding gzip;
        proxy_set_header  Host  "www.google.com";
        gunzip on;

        # 使用ipv4.google.com避免走ipv6导致出错
        location / {
            proxy_pass https://ipv4.google.com;
        }
        # 只对/search做负载均衡,兼具速度和稳定
        location /search {
            proxy_pass  https://google;
        }
    }
}