nginx cache/expire

  • Hey Leute,


    ich hab gerade mal wieder nen bissel an den caching Einstellungen von nginx rumgespielt. Da dachte ich mir, es wäre mal interessant zu sehen, wie andere das Ganze handhaben.

    Nutzt ihr ne extra config für expire map und nutzt quasi nur expires $expires;

    Code
    map $sent_http_content_type $expires {
        default                    off;
        text/html                  epoch;
        text/css                   max;
        application/javascript     max;
        ~image/                    max;

    Oder definiert ihr die einzelnen files im jeweiligen vhost?


    Code
            location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
            expires max;
            }
    
            location ~* ^.+\.(css|js)$ {
            access_log off; 
            log_not_found off; 
            expires 1w; 
            add_header Cache-Control "must-revalidate, proxy-revalidate";
             }

    Würd mich echt mal interessieren, zumal ich auch nicht wirklich weiß, was hier zu empfehle ist und quasi den Goldstandard darstellt.

    Meine Produkte: definitiv zu viele, RS, VPS, Domains, Webhosting, ...