用户替换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
本文介绍如何通过Nginx配置文件实现HTML字符的替换功能,包括具体配置指令和重启Nginx的方法。
2678

被折叠的 条评论
为什么被折叠?



