1. >>ngx_http_substitutions_filter_module OR HttpSubModule ?
为了应急处理或者一些需要,有时候需要使用Nginx的反向代理某站点,并通过 HttpSubModule 和ngx_http_substitutions_filter_module 模块替换正文内容和URL。
但是通常LNMP套件安装的webserver并没有编译安装nginx官方模块HttpSubModule(官方option),并且,官方自带的模块 HttpSubModule 只能匹配1条规则,但是使用第三方模块ngx_http_substitutions_filter_module 可以匹配多条规则。
备注:
ngx_http_substitutions_filter_module 是指第三方nginx模块 substitutions4nginx (原:Google Code 现:github)
HttpSubModule 是指Nginx官方的 with-http_sub_module模块(option)
Nginx自身带的module并不多,这也是它为什么性能好,系统开销较小的原因之一,相比apache,它不能动态的加载module,如果之前编译安装了Nginx,这时候就需要重新编译nginx添加模块,并替换掉原先的nginx执行文件。
2. 1.下载需要的文件
substitutions4nginx github下载
# 下载第三方模块
# cd ~
# git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
3. 2.查看之前Nginx编译configure
# nginx -V
nginx version: nginx/1.2.7
built by gcc 4.6.3(Ubuntu/Linaro4.6.3-1ubuntu5)
TLS SNI support enabled