我正在使用运行nginx + php-fpm的VPS。我的博客基于laravel。我正在尝试优化我的网站以传递网页测试。我从Cache静态内容测试中得到了“C-(72/100)”。
我配置了我的nginx缓存:
# Set header expirations on per-project basis
location ~* \.(?:ico|css|js|gif|jpe?g|JPG|png|svg|woff)(\?ver=[0-9.]+)?$ {
root /home/ytsejam/public/sirtcantalilar.com/public;
expires 365d;
tcp_nodelay off; ## Set the OS file cache.
open_file_cache max=100 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
add_header Pragma public;
add_header Cache-Control "public";
log_not_found off;
}
但是我遇到了一个巨大的faillist:
FAILED - (No max-age or expires) - http://xslt.alexa.com/site_stats/js/s/a?url=sirtcantalilar.com
FAILED - (No max-age or expires) - http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold
FAILED - (No max-age or expires) - http://sirtcantalilar.com/assets/css/fonts/fontawesome-webfont.eot?
FAILED - (No max-age or expires) - http://scontent-b-lga.xx.fbcdn.net/hphotos-frc3/s403x403/988772_225525044282988_738222852_n.jpg
FAILED - (No max-age or expires) - http://sirtcantalilar.com/assets/css/fonts/BebasNeue-webfont.eot?
FAILED - (No max-age or expires) - http://fonts.googleapis.com/css?family=Dosis:400,500,600,700&subset=latin,latin-ext
FAILED - (No max-age or expires) - http://fonts.googleapis.com/css?family=Open+Sans:400,700italic,600italic,700,600,400italic
FAILED - (No max-age or expires) - http://platform.twitter.com/embed/timeline.633fdd7a8cbe780bedb23434c948fe33.default.css
FAILED - (No max-age or expires) - http://sirtcantalilar.com/assets/css/fonts/Entypo.eot?
FAILED - (60 seconds) - http://external.ak.fbcdn.net/safe_image.php?d=AQC0yxqR5PAB_4uM&w=154&h=154&url=http%3A%2F%2Fsirtcantalilar.com%2Fuploads%2Fimg%2Fposts%2Fthumbnails%2F98%2Fthumb-Amsterdam_Light_Festival.jpg&cfs=1.......
如何优化我的缓存规则以及google font apis或twitter无法使用浏览器缓存的原因?
答案 0 :(得分:0)
您无法在域/服务器外部提供服务的对象上设置过期。为什么?因为网页测试“与外部服务器而不是你自己的服务器”进行“对话”。