[root@blog ~]# vi /etc/nginx/conf.d/default.conf
server { listen 80; server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
.........code
.........code
......code
#自己加的 ;意思是当用户请求到gif|jpg|jpeg等等...的文件会自动缓存到用户的电脑上,
下次就不用在给用户一份了,提升用户的体验
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
}