猛牛哥
记录网络点滴生活

NGINX添加subs_filter模块

1、查看nginx当前安装所带参数,执行nginx -V

[root@KS2-CENTOS nginx-1.12.2]# nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 
built with OpenSSL 1.0.2l  25 May 2017
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-openssl=/data/my/lnmp/lnmp1.4/src/openssl-1.0.2l --with-google_perftools_module

2、下载subs_filter模块

进入nginx源码目录,执行:git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git

3、添加新模块并编译(不要make install)

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-openssl=/data/my/lnmp/lnmp1.4/src/openssl-1.0.2l --with-google_perftools_module --add-module=ngx_http_substitutions_filter_module
make

4、替换老的nginx文件为新的nginx文件

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx_old
cp objs/nginx /usr/local/nginx/sbin/

 

赞(0) 打赏
猛牛哥原创:猛牛哥的博客 » NGINX添加subs_filter模块

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏