Gli*_*ome 2 scripting nginx ip logging
我试图不记录来自特定 IP 地址的请求,如下所示:
location = / {
index index.php;
if ( $remote_addr = "spe.ci.fic.ip" )
{
access_log off;
}
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,为什么?
您使用正确的语法
location ~ ^/(css|js) {
if ( $remote_addr = "127.0.0.1" )
{
access_log off;
}
}
Run Code Online (Sandbox Code Playgroud)
在您的示例中,nginx 不会仅为“/”位置写入日志。
| 归档时间: |
|
| 查看次数: |
3688 次 |
| 最近记录: |