nginx增加substitutions_filter模块
2017-12-21 17:46nginx自带的过滤模块无法多次使用,故使用第三方模块substitutions_filter
1.下载模块并解压
wget -O https://github.com/yaoweibin/ngx_http_substitutions_filter_module/archive/master.zip
unzip master.zip
2.查看原nginx编译参数并记录
nginx -V
3.重新编译nginx
./configure --user=www --group=www --prefix=/www/server/nginx --with-openssl=/www/server/nginx/src/openssl --add-module=/www/server/nginx/src/ngx_cache_purge --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-ld-opt=-ljemalloc --add-module=/home/temp/ngx_http_substitutions_filter_module-master 红色部分为新增加模块
make 不再使用mke install 以防止破坏原有的文件
拷贝安装源objs/nginx 到对应目录
4.重新启动nginx
service nginx restart
5.测试效果
location /
{
subs_filter_types *;
subs_filter "uage" "abcd1111";
subs_filter \[InstallDir(.*)Dir\} /shangchuan ir;
subs_filter \[InstallDir_ChannelDir]cet4\/ /waiyu/cet4/ ir;
}
评论