关于nginx 访问日志的控制

最近要用到nginx的访问日志,我的想法是只要记录到html页面即可,忽略图片、css和js,但配置一直不成功,求帮助。
我的配置如下:

...

http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# access_log /usr/logs/nginx/access.log main;

....

server {
    listen       80;
    server_name  gw.test333.com;
    #charset koi8-r;

access_log /usr/logs/nginx/access.log main;

    error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    location / {
            root html;
            index index.html;
            access_log /usr/logs/nginx/access.log main;
    }

    location /images/ {     #这里只试一下忽略图片先,因为我的图片连接URL里面肯定有/images/所以此处这样配置,匹配扩展的做法我也试过,不行
            root html;
            access_log off;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { # 扩展名写法

.............

hi,楼主,
给你一个我刚刚本地测试通过的一个可行的写法:
location ~ .html{
access_log logs/html.access.log;#日志名字你可以随便定义
}

你配置的忽略图片那个,应该是这样写的:
location ~ ^/images/* { #这里只试一下忽略图片先,因为我的图片连接URL里面肯定有/images/所以此处这样配置,匹配扩展的做法我也试过,不行
root html;
access_log off;
}

我这里总结过一个nginx配置:http://hillside.iteye.com/admin/blogs/559772,你可以参考一下。