Nginx記錄post body中文內容

2022-03-02 13:06:16 字數 399 閱讀 1843

nginx 的變數$request_body 即為http請求的body資料

只有在 location中 有 proxy_pass,fastcgi_pass,scgi_pass命令存在時,$request_body變數才會有值。

nginx在記錄http的body內容時,會將中文轉義為16進製制

在nginx 1.11.8 以上版本中log_format 增加了escape=json 引數,可以不轉義變數內容:

log_format access escape=json '$request_time $remote_addr  "$request" "$request_body" $status "$http_referer" "$http_user_agent" '
參考:

nginx學習記錄

這幾天聽了架構配需後,週末研究了nginx,發現它能給我們專案帶來很多幫助 虛擬主機 1.記錄訪問日誌,錯誤日誌 可區分瀏覽器,ip,狀態碼等 2.重定向404,500的頁面 3.根據網域名稱 server name ip,轉向不同的目錄 4.自動索引autoindex,可列出當前目錄下的檔案 5....

nginx學習記錄

nginx修改預設埠 usr local nginx conf nginx.conf server nginx 啟動 cd usr local nginx sbin nginxnginx重啟 kill hup 主程序號或程序號檔案路徑 或者使用 cd usr local nginx sbin ngi...

nginx 安裝記錄

gcc yum install gcc c pcre pcre perl compatible regular expressions 是乙個perl庫,包括 perl 相容的正規表示式庫。nginx的http模組使用pcre來解析正規表示式,所以需要在linux上安裝pcre庫。注 pcre de...