Nginx之15独孤九剑 - (GoogleFilter)

简介: Nginx从入门到深入之Google Proxy

什么是Google Filter

ngx_http_google_filter_module是一个过滤模块,模块已经内置了正则表达式,URI位置和其他复杂配置。模块可确保效率的处理cookie,gstatic scoures和redirections等。

如何使用Google Filter

安装编译环境
yum -y install gcc gcc-c++ git 
安装Nginx依赖
yum -y install pcre-devel openssl-devel zlib-devel 
下载过滤模块
git clone https://github.com/cuber/ngx_http_google_filter_module
下载替换模块
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
配置编译选项及安装
./configure \
--prefix=/usr/local/nginx \
--with-http_ssl_module \
--add-module=../ngx_http_google_filter_module \
--add-module=../ngx_http_substitutions_filter_module
修改配置应用模块
server {
    server_name localhost;
    listen 80;
    resolver 8.8.8.8;
    location / {
          google on;
    }
}
访问测试

直接使用浏览器访问Nginx中配置的server_name即可
clipboard9

相关设置

# 谷歌学术
location  / {
  google_scholar on;
}
# 谷歌语言
location  / {
  google_language en;
}
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
# 不允许搜索引擎爬取
location  / {
  google_robots_allow off;
}
目录
相关文章
|
8月前
|
负载均衡 应用服务中间件 nginx
nginx V1.0
nginx V1.0
|
11月前
|
应用服务中间件 nginx
nginx
nginx
108 0
|
应用服务中间件 网络安全 nginx
nginx应用
nginx应用
98 0
|
存储 机器学习/深度学习 负载均衡
nginx几个简单问题
《基础系列》
90 0
|
应用服务中间件 Apache 开发工具
关于Nginx,你需要知道的!
关于Nginx,你需要知道的!
167 0
|
XML 缓存 应用服务中间件
|
应用服务中间件 nginx
Nginx的使用
Nginx的使用
86 0
Nginx的使用
|
缓存 负载均衡 监控
|
应用服务中间件 nginx
nginx 301 转跳
# 文件资源转跳
55 0