jurchiks Posted August 9, 2013 Report Share Posted August 9, 2013 (edited) Radusies problēma ar nginx un caching. Uz production servera stāv nginx 1.2.3 (zinu, damn old versija, atbildīgajam uztaisīju ticket, lai apdeito, sen tā kā būtu laiks). Ir projekta root folderis /public/. Šajā folderī ir 3 subfolderi /css/, /js/ un /images/. Nginx configi šiem folderiem: location ~ /css/ { include enable-gzip.conf; expires 2w; } location ~ /js/ { include enable-gzip.conf; expires 1M; } location /images/products/ { include enable-gzip.conf; expires 2w; try_files $uri /images/products/index.php; } location /images/ { expires 2w; include enable-gzip.conf; } enable-gzip.conf saturs: gzip on; gzip_disable "MSIE [1-6]\."; gzip_http_version 1.1; gzip_comp_level 6; gzip_types text/plain text/css text/javascript application/x-javascript image/jpeg image/png; gzip_buffers 16 8k; Gan CSS, gan JS failiem ir GET parametrs "?mod=unixtime", /js/jquery... failiem "?mod=static", savukārt attēliem tāda vispār nav. Diemžēl atverot jebkuru lapu, šie faili netiek kešoti, līdz ar to lapa reāli ielādējas 2 sekundes katru reizi, kad tiek pārlādēta, kaut gan saturs tiek kešots un refreshojās tikai min. 1x stundā. Visiem failiem HTTP response code ir 200 un Request headeri satur šādas līnijas: "Cache-Control:no-cache", "Pragma:no-cache". Ir aizdomas, ka /images/ rūlis neuzliekās dziļākiem subfolderiem tajā mapē, tur ir vēl pa kategorijām un preču ID subfolderi, bet tas neattiecas uz css/js, kuros iekšā nav neviena subfoldera. WTF is this and how do I fix it? Edited August 9, 2013 by jurchiks Quote Link to comment Share on other sites More sharing options...
spainis Posted August 9, 2013 Report Share Posted August 9, 2013 add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate" Quote Link to comment Share on other sites More sharing options...
jurchiks Posted August 9, 2013 Author Report Share Posted August 9, 2013 (edited) Visos tajos location blokos? Un vai ir svarīgi - pirms vai pēc expires direktīvas? Edit: nvm, pieliku pēc, it kā strādā. Edited August 9, 2013 by jurchiks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.