Nginx有话说之二

[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
    #自己加的 ;意思是当用户请求到js css的文件会自动缓存到用户的电脑上,
    下次就不用在给用户一份了,提升用户的体验
location ~.*\.(js|css|jpg|png|swf)?${

    expires 30d;在用户电脑里缓存时间是一个月
}

猜你喜欢

转载自blog.51cto.com/kangxi/2407563