Nginx屏蔽F5心跳日志、指定IP访问日志
更新时间:2015年04月17日 09:13:12 投稿:junjie
这篇文章主要介绍了Nginx屏蔽F5心跳日志、指定IP访问日志,本文直接给出配置示例,需要的朋友可以参考下
复制代码 代码如下:
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://mmt;
if ( $remote_addr != 192.168.0.2 ) {
access_log /var/log/nginx/nginx_access_abres.log;
}
}
注:192.168.0.2是F5内网地址。
下面的配置经测试是失败的,依然记录访问日志:
复制代码 代码如下:
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://mmt;
deny 192.168.0.2;
}
推测是日志记录在deny前执行,执行到deny返回403 Forbidden。
相关文章
nginx ingress代理websocket流量的配置方法
ingress nginx默认支持websocket协议,使用长连接协议时需要注意连接超时的设置,文中有提到读取和发送超时的注解参数,通过本文阅读可以快速掌握,对nginx ingress代理websocket相关知识感兴趣的朋友一起看看吧2022-03-03结合 Nginx 将 DoNetCore 部署到 阿里云的安装配置方法
这篇文章主要介绍了结合 Nginx 将 DoNetCore 部署到 阿里云的方法 ,需要的朋友可以参考下2018-10-10Nginx报错host not found in upstream的解决办法
本文主要介绍了Nginx报错host not found in upstream的解决办法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2023-08-08
最新评论