Nginx之15独孤九剑 - (GoogleFilter)

什么是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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值