教你怎么样在大陆直接使用google搜索-Nginx篇

一、环境准备

我们需要一个nginx的模块来进行设置,ngx_http_google_filter_module。前

提我们是有一个海外的VPS,并且可以访问谷歌,我的VPS是亿速云香港的。

首先先感受一下我的成果吧,请点击http://google.qinyj.top

二、软件安装

我的操作系统是CentOS 6.x 64位操作系统,如果为了快速搭建的话,直接使用我编译好的RPM包,可以加我VX索取,几分钟就可以搞定。

cd /root/

wget http://nginx.org/download/nginx-1.7.8.tar.gz

git clone https://github.com/cuber/ngx_http_google_filter_module

git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_moduletar xzf nginx-1.7.8.tar.gz

cd nginx-1.7.8

./configure

--prefix=/usr/local/nginx

--user=nginx

--group=nginx

--with-http_ssl_module

--with-http_flv_module

--with-http_stub_status_module

--with-http_gzip_static_module

--with-pcre

--add-module=/root/ngx_http_google_filter_module

--add-module=/root/ngx_http_substitutions_filter_module

make && make install

三、配置nginx

1 vim /usr/local/nginx/conf/nginx.conf

在http模块里面增加如下内容

upstream google {

server 173.194.38.1;

server 173.194.38.2;

server 173.194.38.3;

server 173.194.38.4; #通过dig -t A www.google.com获取谷歌的IP地址}

server {

resolver 8.8.8.8;

location / {

google on; #启用谷歌镜像功能

#google_scholar on; #启用谷歌学术搜索,可以不设定

#google_robots_allow on; #允许蜘蛛爬镜像站点,可以不设定

google_language en; #设定谷歌的语言,语言可以自己随意定义,支持的语言请看附录

#google_ssl_off "google"; #不适用https访问} }

server {

listen 80;

server_name google.qinyj.top;

location / {

proxy_pass http://google; #反向代理到upstream }

}

教你怎么样在大陆直接使用google搜索-Nginx篇

评论

目前评论:0   

点击加载更多评