天天看點

nginx不記錄指定檔案類型的日志

不記錄指定檔案類型的日志

server{

    listen 80;

    server_name www.test1.com www.aaa1.com www.bbb1.com;

    if ($host != 'www.test1.com')

      {

   rewrite ^/(.*)$ http://www.test1.com/$1 permanent;

     }

    index index.html index.htm index.php;

    root /data/www;

     access_log /tmp/access.log 123456;

    location ~ .*admin\.php$ {

       auth_basic "123123 auth";

      auth_basic_user_file /usr/local/nginx/conf/.htpasswd;

include fastcgi_params;

        fastcgi_pass unix:/tmp/www.sock;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;

}

   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$

       {

    access_log off;

    }

   location ~ (static|cache)$

   location ~ \.php$ {

        include fastcgi_params;

}本文轉自 boy461205160 51CTO部落格,原文連結:http://blog.51cto.com/461205160/1735419