ngx_http_google_filter_module扩展模块介绍
ngx_http_google_filter_module是一个过滤器模块,能够让谷歌镜像更便捷的部署。内建了正则表达式、URI locations和其他复杂的配置。原生nginx模块确保了更加高效地处理cookies, gstatic scoures和重定向。
轻松部署
环境: CentOS6.7(Final)纯净系统
1、依赖库
pcre 正则
ngx_http_proxy_module 反向代理
ngx_http_substitutions_filter_module 多重替换
ngx_http_proxy_module 反向代理
ngx_http_substitutions_filter_module 多重替换
1.安装Git&GCC
yum -y groupinstall "Development Tools" yum -y install git gcc make epel-release
2.下载组件
wget http://nginx.org/download/nginx-1.8.0.tar.gz wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz" wget "https://www.openssl.org/source/openssl-1.0.1j.tar.gz" wget "http://zlib.net/zlib-1.2.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
3.解压缩
tar xzvf nginx-1.8.0.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
4.进入Nginx目录,编译
groupadd www useradd -s /sbin/nologin -g www www cd nginx-1.8.0 1
./configure \ --prefix=/usr/local/nginx-1.8.0 \ --with-pcre=../pcre-8.38 \ --with-openssl=../openssl-1.0.1j \ --with-zlib=../zlib-1.2.8 \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_spdy_module \ --with-http_gzip_static_module \ --with-ipv6 \ --with-http_sub_module \ --add-module=../ngx_http_google_filter_module \ --add-module=../ngx_http_substitutions_filter_module
5.make
make make install
6.SSL证书
用途不多说,你懂我懂大家懂。
这里使用很不错的Let’s Encrypt免费SSL,申请要求与申请过程不多说,域名指源、关闭80/443端口是必须的。
如果提示python版本太低,可以参考http://www.cnblogs.com/dudu/p/4294238.html升级Python版本
7.Nginx 设置
mkdir /usr/local/nginx-1.8.0/conf/vhost cd /usr/local/nginx-1.8.0/conf/ vi nginx.conf
在底部加入:
include vhost/*.conf;
然后保存并退出。
cd vhost vi gotogoogle.conf
加入以下内容,根据自己实际需要修改:
server { server_name 你的域名 listen 443; ssl on; ssl_certificate 你的证书; ssl_certificate_key 你的私钥; resolver 8.8.8.8; location / { google on; google_scholar on; } } upstream www.google.com { server 216.58.216.196:443; server 216.58.216.195:443; server 216.58.216.194:443; server 216.58.216.193:443; server 216.58.216.192:443; }
8.重载Nginx
/usr/local/nginx-1.8.0/sbin/nginx -s reload
9.Enjoy It!
访问:https://你的域名
查看成果吧!
相关文章
为您推荐
各种观点