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

简介:

一、环境准备

    我们需要一个nginx的模块来进行设置,ngx_http_google_filter_module。前提我们是有一个海外的VPS,并且可以访问谷歌,我的VPS是阿里云香港的。

    首先先感受一下我的成果吧,请点击http://g.wzlinux.com

二、软件安装

    我的操作系统是CentOS 6.x 64位操作系统,最下面有我编译好的nginx,如果为了快速搭建的话,直接使用我编译好的二进制程序和配置文件,几分钟就可以搞定。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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_module
tar  xf nginx-1.7.8. tar .gz
cd  nginx-1.7.8
 
. /configure  \
--prefix= /usr/  \
--sbin-path= /usr/sbin/nginx  \
--conf-path= /etc/nginx/nginx .conf \
--error-log-path= /var/log/nginx/error .log \
--http-log-path= /var/log/nginx/access .log \
--pid-path= /var/run/nginx/nginx .pid \
--lock-path= /var/lock/nginx .lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path= /var/tmp/nginx/client/  \
--http-proxy-temp-path= /var/tmp/nginx/proxy/  \
--http-fastcgi-temp-path= /var/tmp/nginx/fcgi/  \
--http-uwsgi-temp-path= /var/tmp/nginx/uwsgi  \
--http-scgi-temp-path= /var/tmp/nginx/scgi  \
--with-pcre \
--add-module= /root/ngx_http_google_filter_module  \
--add-module= /root/ngx_http_substitutions_filter_module
 
make
make  install

三、配置nginx

1
vim  /etc/nginx/nginx .conf

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 _;               #好像是填写什么域名,域名就无法访问 
       location / { 
            proxy_pass http: //google ;     #反向代理到upstream 
        
}

    下面是nginx的启动脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh
#
# nginx        Startup script for nginx
#
# chkconfig: - 85 15
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# description: nginx is an HTTP and reverse proxy server
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop nginx
### END INIT INFO
# Source function library.
/etc/rc .d /init .d /functions
if  [ -L $0 ];  then
     initscript=` /bin/readlink  -f $0`
else
     initscript=$0
fi
sysconfig=` /bin/basename  $initscript`
if  [ -f  /etc/sysconfig/ $sysconfig ];  then
     /etc/sysconfig/ $sysconfig
fi
nginx=${NGINX- /usr/sbin/nginx }
prog=` /bin/basename  $nginx`
conffile=${CONFFILE- /etc/nginx/nginx .conf}
lockfile=${LOCKFILE- /var/lock/nginx .lock}
pidfile=${PIDFILE- /var/run/nginx/nginx .pid}
SLEEPMSEC=${SLEEPMSEC-200000}
UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS-5}
RETVAL=0
start() {
     echo  -n $ "Starting $prog: "
     daemon --pidfile=${pidfile} ${nginx} -c ${conffile}
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] &&  touch  ${lockfile}
     return  $RETVAL
}
stop() {
     echo  -n $ "Stopping $prog: "
     killproc -p ${pidfile} ${prog}
     RETVAL=$?
     echo
     [ $RETVAL = 0 ] &&  rm  -f ${lockfile} ${pidfile}
}
reload() {
     echo  -n $ "Reloading $prog: "
     killproc -p ${pidfile} ${prog} -HUP
     RETVAL=$?
     echo
}
upgrade() {
     oldbinpidfile=${pidfile}.oldbin
     configtest -q ||  return
     echo  -n $ "Starting new master $prog: "
     killproc -p ${pidfile} ${prog} -USR2
     echo
     for  in  ` /usr/bin/seq  $UPGRADEWAITLOOPS`;  do
         /bin/usleep  $SLEEPMSEC
         if  [ -f ${oldbinpidfile} -a -f ${pidfile} ];  then
             echo  -n $ "Graceful shutdown of old $prog: "
             killproc -p ${oldbinpidfile} ${prog} -QUIT
             RETVAL=$?
             echo
             return
         fi
     done
     echo  $ "Upgrade failed!"
     RETVAL=1
}
configtest() {
     if  "$#"  - ne  0 ] ;  then
         case  "$1"  in
             -q)
                 FLAG=$1
                 ;;
             *)
                 ;;
         esac
         shift
     fi
     ${nginx} -t -c ${conffile} $FLAG
     RETVAL=$?
     return  $RETVAL
}
rh_status() {
     status -p ${pidfile} ${nginx}
}
# See how we were called.
case  "$1"  in
     start)
         rh_status > /dev/null  2>&1 &&  exit  0
         start
         ;;
     stop)
         stop
         ;;
     status)
         rh_status
         RETVAL=$?
         ;;
     restart)
         configtest -q ||  exit  $RETVAL
         stop
         start
         ;;
     upgrade)
         rh_status > /dev/null  2>&1 ||  exit  0
         upgrade
         ;;
     condrestart|try-restart)
         if  rh_status > /dev/null  2>&1;  then
             stop
             start
         fi
         ;;
     force-reload|reload)
         reload
         ;;
     configtest)
         configtest
         ;;
     *)
         echo  $ "Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest}"
         RETVAL=2
esac
exit  $RETVAL

四、验证成果    

    最后启动nginx并且访问,大功告成,我自己搭建的地址是:g.wzlinux.com。

wKioL1Z4yy_QMYsBAAC6ZL69BHA409.jpg


语言附录:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ar    -> Arabic
bg     -> Bulgarian
ca    -> Catalan
zh-CN -> Chinese (Simplified)
zh-TW -> Chinese (Traditional)
hr    -> Croatian
cs    -> Czech
da    -> Danish
nl     -> Dutch
en    -> English
tl    -> Filipino
fi     -> Finnish
fr    -> French
de    -> German
el    -> Greek
iw    -> Hebrew
hi    -> Hindi
hu    -> Hungarian
id     -> Indonesian
it    -> Italian
ja    -> Japanese
ko    -> Korean
lv    -> Latvian
lt    -> Lithuanian
no    -> Norwegian
fa    -> Persian
pl    -> Polish
pt-BR -> Portuguese (Brazil)
pt-PT -> Portuguese (Portugal)
ro    -> Romanian
ru    -> Russian
sr    -> Serbian
sk    -> Slovak
sl    -> Slovenian
es    -> Spanish
sv    -> Swedish
th    -> Thai
tr     -> Turkish
uk    -> Ukrainian
vi     -> Vietnamese


    如果大家懒得编译,就向快速使用的话,那请去下载我编译好的二进制程序及配置文件。

    http://down.51cto.com/data/2225684



     本文转自 wzlinux 51CTO博客,原文链接:http://blog.51cto.com/wzlinux/1727127,如需转载请自行联系原作者



相关文章
|
6月前
|
人工智能 自然语言处理 数据可视化
Google SGE 正在添加人工智能图像生成器,现已推出:从搜索中的生成式 AI 中获取灵感的新方法
Google SGE 正在添加人工智能图像生成器,现已推出:从搜索中的生成式 AI 中获取灵感的新方法
178 1
|
9月前
|
数据采集 JavaScript 搜索推荐
对于Python抓取Google搜索结果的一些了解
对于Python抓取Google搜索结果的一些了解
|
10月前
|
开发框架 算法 搜索推荐
涨知识|Google语法快速高效的搜索
涨知识|Google语法快速高效的搜索
134 0
|
10月前
|
前端开发 JavaScript Python
10 个使用 Google 搜索的小技巧
最近 Twitter 上有一篇介绍 Google 搜索技巧的帖子,觉得非常实用,所以分享给大家,原帖子地址放在文末了。
92 0
10 个使用 Google 搜索的小技巧
|
算法 搜索推荐 SEO
2023年谷歌搜索排名规则揭秘,Google排名机制
也许流量不会很多,就几个点击,但也足以让谷歌判断你的内容是否满足用户的需求。
270 0
2023年谷歌搜索排名规则揭秘,Google排名机制
|
XML Android开发 数据格式
android google market 不能搜索到facebook或显示不兼容
android google market 不能搜索到facebook或显示不兼容
144 0
|
网络协议 安全
Bing搜索没法用的解决办法(附Google和edge的详细解决步骤)
Bing搜索没法用的解决办法(附Google和edge的详细解决步骤)
3766 0
Bing搜索没法用的解决办法(附Google和edge的详细解决步骤)
|
搜索推荐
google搜索配置
google搜索配置
29294 0
|
存储 负载均衡 搜索推荐
Google搜索为什么不能无限分页?
这是一个很有意思却很少有人注意的问题。 当我用Google搜索`MySQL`这个关键词的时候,Google只提供了`13`页的搜索结果,我通过修改url的分页参数试图搜索第`14`页数据,结果出现了以下的错误提示:
Google搜索为什么不能无限分页?
|
Java
Google - 搜索图片快速设置
Google - 搜索图片快速设置
88 0
Google - 搜索图片快速设置

热门文章

最新文章