我希望nginx的access_log忽略HEAD请求,意味着不要loggingHEAD请求。 这是我的configuration文件,但它不工作,任何人都可以帮忙吗? 非常感谢〜
server { listen 80; server_name localhost; index index.html index.htm index.php default.html default.htm default.php; root /data/data.com; location / { if ($request_method = "HEAD" ) { access_log off; } try_files $uri $uri/ /index.php?$query_string; # deny access to apache .htaccess files location ~ /\.ht { deny all; } location ~ /\.git { deny all; } location ~ [^/]\.php(/|$) { # comment try_files $uri =404; to enable pathinfo fastcgi_split_path_info ^(.+\.php)(/.+)$; #try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param HTTPS on; include fastcgi.conf; include fastcgi_params; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } access_log /data/logs/access_log/cissdata.com.log main; error_log /data/logs/error_log/cissdata.com-error.log error; }