俗话说:百度一下,你就知道,谷歌一下,你就知道太多。工作生活中,真的是离不开Google,虽然手机中有VPS,但是工作的环境,老是拿手机查也不是办法,而且公司有信息安全的要求,不让安装VPN等工具,于是就想到了Google镜像的方法。
开始想的方法是创建一个网站,然后提供搜索页面,后端再调用Google搜索引擎的结果返回给前端。放弃的原因:一是工作量比较大;二是Google禁止这种方式调用。
最终发现了Nginx+Google扩展的神器:
https://github.com/cuber/ngx_http_google_filter_module/blob/master/README.zh-CN.md
按照上述步骤操作,应该没啥大问题。
几点说明:
1. 搬瓦工系统,Centos 6 x86_64
2. 选择的是“最简安装”,Nginx版本
nginx-1.7.8
3. 启动Nginx服务错误
service nginx start
/usr/local/nginx/sbin/nginx: error
解决办法:
sudo cp -r /opt/nginx-1.7.8 /usr/local/nginx
猜想是执行路径的问题:
[root@localhost nginx]# whereis nginx
nginx: /usr/local/nginx
4. 修改Nginx的配置文件
/usr/local/nginx/conf/nginx.conf
增加下列代码:
server {
server_name gooo.tk; # name改为你自己的
listen 80;
resolver 8.8.8.8;
location /
{
google on;
}
}
5. 大功告成,欢迎大家使用我搭建的Google镜像网站
![](https://img.haomeiwen.com/i3044493/1316326f6f0296bb.png)
网友评论