搭建Google镜像网站

  1. 很多人FQ或者买VPN账号仅仅只是为了使用Google搜索。相对于搭建VPN服务器来说,下面的方法搭建Google镜像网站将更加便捷。
  2. 条件:最好有自己的域名(可选),有可以正常访问Google的服务器(必须),使用Nginx做反向代理即可。
  3. 操作步骤如下
    yum -y install epel-release nginx php php-fpm
    sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php.ini
    service php-fpm restart
    chkconfig php-fpm on
    cd /etc/nginx/conf.d/
    touch google.conf
    vim google.conf 将如下信息粘贴至google.conf文件中
    server {
        listen       80;
        server_name  www.abc.com;
    
        location / {
            proxy_pass https://www.google.com;
            proxy_connect_timeout 120;
            proxy_read_timeout 600;
            proxy_send_timeout 600;
            send_timeout 600;
            proxy_redirect    off;
            proxy_set_header X-Real-IP $remote_addr;
    #        proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
        }
    
    }

    重启Nginx即可。

  4. 将上述代码中www.abc.com更换为自己的域名即可,更改hosts文件做测试均可。
    效果图如下:
  5. 使用同样的办法可以代理其他的网站,如facebook、youtube、twitter等。
  6. 上述只是粗略的搭建,但不影响使用,当用户数增多,请参考我之前文章或其他资料,对Nginx做进一步的优化。
    http://www.cnblogs.com/Mrhuangrui/p/4560294.html
  7. 由于Google使用了Https加密,所以代理服务器并不能获取到用户所搜索过的关键词,放心使用即可。Have Fun.
  8. 为防止访问用户过多,可以设置访问账号密码限制用户访问
    https://www.digitalocean.com/community/tutorials/how-to-set-up-http-authentication-with-nginx-on-ubuntu-12-10
posted @ 2015-09-07 10:12  Mr黄瑞  阅读(2277)  评论(0编辑  收藏  举报