我试图不logging从一个特定的IP地址,如下所示的请求:
location = / { index index.php; if ( $remote_addr = "spe.ci.fic.ip" ) { access_log off; } }
但它不起作用,为什么?
你使用正确的语法
location ~ ^/(css|js) { if ( $remote_addr = "127.0.0.1" ) { access_log off; } }
在你的例子中,nginx不会为“/”位置写入日志。