[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;
}
}