我是靠谱客的博主 灵巧秀发,这篇文章主要介绍Nginx 配置日志打印--HTTP报文 ,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
http { include mime.types; default_type application/octet-stream; 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"'; access_log logs/access.log main; } 以上为全局配置,打印所有请求的报文,与可按如下配置,只获取某个请求路径下的HTTP报文: http { include mime.types; default_type application/octet-stream; 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"'; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; } server { listen 8080; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /mypath { access_log logs/access.log main; } }

 

最后

以上就是灵巧秀发最近收集整理的关于Nginx 配置日志打印--HTTP报文 的全部内容,更多相关Nginx内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(86)

评论列表共有 0 条评论

立即
投稿
返回
顶部