<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                今天,突然研發的同事說需要在公司網站頁面底部添加一個流量統計的scripts,但是不打算改代碼,所以希望能在代理的層面解決。這里只討論如果是在nginx來實現,技術如何操作。但是具體是研發改代碼,還是寫在nginx,這個視情況而定。 這里可以使用 nginx 的 ngx_http_sub_module 模塊完成。我這里是使用tengine,所以這個模塊已經有了。如果沒有的話,自己編譯添加以下:方法如下: # 查看后發現,默認安裝沒有開啟這個模塊 nginx -V ![nginx頁面替換01](http://upload-images.jianshu.io/upload_images/6954572-576cace964602ecc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 "nginx頁面替換") # 保存好修改的文件,使用brew卸載掉nginx再重裝 然后修改nginx配置文件,在對應的 server > location 上下文中,添加 sub_filter 指令。 這里使用了變量 $injected 保存了腳本地址,對response中有 body 標簽的地方修改插入。 # nginx.conf ``` location / { ????... ????set $injected '<script src="統計代碼引用的js地址如:http://localhost:8088/other/status.js"></script>'; ????sub_filter '<body>' '<body>${injected}'; ????sub_filter_types *; ????sub_filter_once on; #sub_filter 一行代碼前面是需要替換的內容,后面單引號內是替換成的內容。 #sub_filter_once 意思是只查找并替換一次。on是開啟此功能,off是關閉——默認值是on。 #sub_filter_types 一行意思是選定查找替換文件類型為文本型。也可以不加此行,因為默認只查找text/html文件。 #sub_filter模塊可以用在http, server, location模塊中。主要作用就是查找替換文件字符。 } ``` 這里還可以在 sub_filter 多添加一條規則,將客戶端ip地址替換注入到頁面中。 # 替換響應中的 UUIP_IP 字段為 ip 地址 sub_filter 'UUIP_IP' '${remote_addr}'; 轉載自:http://www.ppzedu.com/archives/1049.html
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看