小编Mic*_*ano的帖子

nginx 访问日志忽略某些请求

我在 haproxy 后面运行 nginx(在同一台服务器上运行)。我已将 haproxy 配置为在 nginx 上使用一个简单的 html 文件来验证服务是否已启动,因为我在此主机上没有/不想要有效的“/”URL。Nginx 不支持 OPTIONS 请求类型(据我所知)这是 haproxy 使用的默认值,因此我将其更改为 GET。

由于我在 nginx 中打开了访问日志,因此我在访问日志中收到了所有这些正常运行时间轮询请求。有没有办法可以将 nginx 配置为忽略某些请求,并跳过记录它们?

这是 haproxy 后端:

backend static_http
        option  httpchk GET /test.html
        option  redispatch
        balance roundrobin
        #fullconn 1000
        server  w1_static www1:81 check port 81 inter 2000
Run Code Online (Sandbox Code Playgroud)

这是我在 nginx 日志中看到的:

127.0.0.1 - - [24/Jul/2009:19:28:22 +0000] "GET /test.html HTTP/1.0" 200 12 "-" "-"
127.0.0.1 - - [24/Jul/2009:19:28:24 +0000] "GET /test.html HTTP/1.0" 200 12 "-" "-"
127.0.0.1 - - [24/Jul/2009:19:28:26 +0000] "GET /test.html HTTP/1.0" 200 …
Run Code Online (Sandbox Code Playgroud)

nginx log-files haproxy

9
推荐指数
3
解决办法
1万
查看次数

标签 统计

haproxy ×1

log-files ×1

nginx ×1