nginx 字符串全部替换 sub_filter_once off

nginx 有个字符替换模块, ngx_http_sub_module , 可以对字符进行替换,默认只替换一次。通过设置sub_filter_once off 可以全部替换。

sub_filter_once off

关闭只替换一次。

相关配置

  1. sub_filter
  2. sub_filter_last_modified
  3. sub_filter_once
  4. sub_filter_types

Sets a string to replace and a replacement string. The string to replace is matched ignoring the case. The string to replace (1.9.4) and replacement string can contain variables. Several sub_filter directives can be specified on the same configuration level (1.9.4). These directives are inherited from the previous configuration level if and only if there are no sub_filter directives defined on the current level.

http://nginx.org/en/docs/http/ngx_http_sub_module.html#sub_filter