nignx开启expires后相关资源不显示的问题

expires可以指定浏览器缓存,加快浏览速度

但是开启expires必须先指定root

server中原来指定

location / {

root D:/WWW;
index index.html index.htm default.html default.htm index.php default.php app.php u.php;
}

include expires.conf;

改为

root D:/WWW;
location / {
index index.html index.htm default.html default.htm index.php default.php app.php u.php;
}

include expires.conf;

即可

另附上expires.conf文件内容

location ~ .*\.(jpg|jpeg|gif|png|bmp|ico|swf)$ {
expires 4h;
access_log off;
}
location ~ .*\.(js|css)$ {
expires 1d;
access_log off;
}

posted @ 2015-12-09 11:21  Bin_x  阅读(443)  评论(0)    收藏  举报