<span style="color: #800080">1<span style="color: #000000">.安装此模块需要先安装sregex运行库<span style="color: #000000">apt-<span style="color: #0000ff">get <strong>update</strong>;<br/>apt-<span style="color: #0000ff">get install <strong>git make gcc</strong> -<span style="color: #000000">y <br/>#Centos改成yum git clone https:<span style="color: #008000">//<span style="color: #008000">github.com/agentzh/<strong>sregex</strong><span style="color: #000000">cd sregex make make install cd .. git clone https:<span style="color: #008000">//<span style="color: #008000">github.com/agentzh/<strong>replace-filter-nginx-module</strong>wget http:<span style="color: #008000">//<span style="color: #008000">nginx.org/download/nginx-1.2.6.tar.gz tar zxvf nginx-<span style="color: #800080">1.2.<span style="color: #800080">6<span style="color: #000000">.tar.gz cd nginx-<span style="color: #800080">1.2.<span style="color: #800080">6<span style="color: #000000">./configure <strong>--add-module=../replace-filter-nginx-</strong><span style="color: #000000"><strong>module</strong> #自行加其他编译参数 make make install nginx.conf的用法举例:<span style="color: #000000">location /<span style="color: #000000">t { default_type text/<span style="color: #000000">html; echo abc; replace_filter <span style="color: #800000">'<span style="color: #800000">ab|abc<span style="color: #800000">'<span style="color: #000000"> X; } location /<span style="color: #000000"> { # proxy_pass/fastcgi_pass/<span style="color: #000000">... # caseless <span style="color: #0000ff">global<span style="color: #000000"> substitution: replace_filter <span style="color: #800000">'<span style="color: #800000">\d+<span style="color: #800000">' <span style="color: #800000">'<span style="color: #800000">blah blah<span style="color: #800000">' <span style="color: #800000">'<span style="color: #800000">ig<span style="color: #800000">'<span style="color: #000000">; replace_filter_types text/plain text/<span style="color: #000000">css; }</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
以上就是Nginx替换过滤文本模块实例教程的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号