nginx 配置接收 post 請求引數
nginx.conf
http{
...省略...
log_format post_tracking '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body" ';
}
也可以如此配置 讓你更加的方便
log_format post_tracking '客戶端地址:$remote_addr OR "$http_x_forwarded_for" [$time_local] 請求狀態:$status 傳送給客戶端的位元組數:$body_bytes_sent 客戶瀏覽器資訊:"$http_user_agent" \r\n >請求url跟請求協議:"$request" 引數:"$request_body" 處理時間:"$request_time" '
server
access_log
access_log /data/wwwlogs/qubar_nginx.log post_tracking
重啟
systemctl reload nginx
檢視成果
tail -f /data/wwwlogs/qubar_nginx.log
如下成功
[16/Apr/2018:10:37:23 +0800] "POST /bar/field HTTP/1.1" 200 620 "-" "okhttp/3.9.1" "-" "barId=8&orderDate=2018-04-16"