log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
log_format test '$remote_addr $status' ;
access_log /var/log/nginx/host.access.log test;
[root@localhost blog.abc.com]# cat /var/log/nginx/host.access.log 192.168.254.1 200 127.0.0.1 301
location ~* \.(png|jpeg|gif|js|css|bmp|flv)$ { access_log off; }
補充:css
tail -f /data/logs/bbs.access.log //-f選型能夠動態查看一個文件的內容nginx
">"能夠清空一個文件內容正則表達式
~* 表示不區分大小寫的匹配 後面跟正則表達式 .表示任意一個字符瀏覽器
/var/log/nginx/*.log { daily dateext missingok rotate 52 compress delaycompress notifempty create 640 nginx adm sharedscripts postrotate if [ -f /var/run/nginx.pid ]; then kill -USR1 `cat /var/run/nginx.pid` fi endscript