1、環境準備nginx
咱們須要一個nginx的模塊來進行設置,ngx_http_google_filter_module。前提咱們是有一個海外的VPS,而且能夠訪問谷歌,個人VPS是億速雲香港的。git
首先先感覺一下個人成果吧,請點擊http://google.qinyj.topgithub
2、軟件安裝vim
個人操做系統是CentOS 6.x 64位操做系統,最下面有我編譯好的nginx,若是爲了快速搭建的話,直接使用我編譯好的二進制程序和配置文件,幾分鐘就能夠搞定。bash
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
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 \
--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
|
3、配置nginxgoogle
1
|
vim
/etc/nginx/nginx
.conf
|
在http模塊裏面增長以下內容spa
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 google.qinyj.top;
#好像是填寫什麼域名,域名就沒法訪問
location / {
proxy_pass http:
//google
;
#反向代理到upstream
}
}
|