lanying56123 发表于 2018-11-10 14:26:18

nginx日志不记录及日志切割

server  
{
  
    listen      80;
  
    server_name www.test.comwww.123.com;
  
    index       index.html index.htm index.php;
  
    root      /data/www;
  
    access_log/tmp/logs/access_logtest;   #开启日志
  
    if ($host != 'www.test.com') {
  
      rewrite ^/(.*)$ http://www.test.com/$1 permanent;
  
    }
  

  

  
    location ~ .*forum\.php$ {
  

  
      auth_basic             "auth";
  
      auth_basic_user_file/usr/local/nginx/conf/htpasswd;
  
      include fastcgi_params;
  
      fastcgi_pass 127.0.0.1:9000;
  
      fastcgi_index index.php;
  
      fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
  
    }
  

  
    location ~ .*\.(gif|jpg|png|jpeg|bmp|swf)$ {         #不记录对这些东西的访问
  
      access_logoff;
  

  
    }
  

  
    location ~ \.php$ {
  
      include fastcgi_params;
  
      fastcgi_pass 127.0.0.1:9000;
  
      fastcgi_index index.php;
  
      fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
  
    }
  

  
}


页: [1]
查看完整版本: nginx日志不记录及日志切割