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