# cd /usr/local/nginx/conf/vhosts
# vim test.conf
server
{
listen 80;
server_name www.test.com;
index index.html index.htm index.php;
root /data/www;
# 定义访问日志的路径和格式
access_log /tmp/nginx_access.log test;
# 不记录静态文件的的访问日志
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|rar|zip|gz|bz2)$ {
access_log off;
expires 10d;
}
location ~ \.(js|css) {
access_log off;
expires 2h;
}
}