简体   繁体   中英

YII framework is caching css file

recently i download the OpanBay project to host it. As i was trying to edit the layout i found that both nginx and YII were caching css and js files. I tried to disable it from the nginx config but still the css is cached.

What i did:

on the vhost i removed the following lines:

gzip       on;
gzip_comp_level 3;
gzip_types text/plain text/css text/javascript application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss;


location ~ \.(js|css|png|jpg|gif|swf|ico|svg)$ {
    fastcgi_hide_header        Set-Cookie;
    open_file_cache            max=10000 inactive=14d;
    open_file_cache_errors     on;
    open_file_cache_min_uses   3;
    open_file_cache_valid      1m;
    output_buffers             1  2m;

    expires                    14d;
}

on config.php i removed the following lines:

'cache' => array(  
    'class' => 'system.caching.CFileCache'  
), 

But still no luck. I have no idea how the framework works.

Yii stores it's css and js files in a directory called /assets . You can delete this directory and it'll automatically creates generates the files for the next request it receives. http://www.yiiframework.com/wiki/148/understanding-assets/#hh4

But by removing following may cause problems, If it's not handled well in your application.

'cache' => array(  
    'class' => 'system.caching.CFileCache'  
), 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM