在centos上建个google镜像站

来源:互联网 发布:网页过滤软件 编辑:程序博客网 时间:2024/06/06 18:03

有时候只是想用google搜索下,如果又vpn,又ss的,很是麻烦,google镜像站就很方便,打开即用

链接 https://github.com/cuber/ngx_http_google_filter_module/blob/master/README.zh-CN.md

步骤如下

准备必要工具

yum install -y gcc gcc-c++ git make
#

下载最新版源码

http://nginx.org/en/download.html

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

#

下载最新版 pcre

#
wget “ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz”

#

下载最新版 openssl

#
wget “https://www.openssl.org/source/openssl-1.0.1j.tar.gz”

#

下载最新版 zlib

#
wget “http://zlib.net/zlib-1.2.8.tar.gz”

#

下载本扩展

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

#

下载 substitutions 扩展

#
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module

#

解压缩

#
tar xzvf nginx-1.7.8.tar.gz
tar xzvf pcre-8.38.tar.gz
tar xzvf openssl-1.0.1j.tar.gz
tar xzvf zlib-1.2.8.tar.gz

#

进入 nginx 源码目录

#
cd nginx-1.7.8

#

设置编译选项

#
./configure \
–prefix=/opt/nginx-1.7.8 \
–with-pcre=../pcre-8.38 \
–with-openssl=../openssl-1.0.1j \
–with-zlib=../zlib-1.2.8 \
–with-http_ssl_module \
–add-module=../ngx_http_google_filter_module \
–add-module=../ngx_http_substitutions_filter_module

#

编译, 安装

如果扩展有报错, 请发 issue 到

https://github.com/cuber/ngx_http_google_filter_module/issues

#
make
sudo make install

#

启动, 安装过程到此结束

#
/opt/nginx-1.7.8/sbin/nginx

#

配置修改后, 需要 reload nginx 来让配置生效,

#
/opt/nginx-1.7.8/sbin/nginx -s reload

安装完成后,配置下即可

http配置方式

server {
server_name <你的域名>;
listen 80;

resolver 8.8.8.8;
location / {
google on;
}
}

0 0