nginx记录POST请求

常见的nginx配置中只能记录GET请求,没有记录POST请求,可通过以下方法实现:

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent $request_body "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

添加 $request_body 在log_format段中重启nginx即可。

版权声明:
作者:admin
链接:https://www.chenxie.net/archives/761.html
来源:蜀小陈
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>