nginx学习sub_filter模块


用户替换html中的字符

  location / {
        root   /opt/app/code/;
        random_index on;
        index  index.html index.htm;
        sub_filter '<h1>Admin' '<h1>ggggg';  //第一个参数是要被替换的,第二个参数是替换后的
        sub_filter_once off;   //替换所有的,默认是on,替换第一个
     }

改完保存下,使用命令检查nginx语法是否正确

nginx -tc /etc/nginx/nginx.conf

平滑重启nginx

nginx -s reload -c /etc/nginx/nginx.conf

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM