UNPKG

slush-source4

Version:

Source 4 generator

92 lines (80 loc) 3.22 kB
# ---------------------------------------------------------------------- # | Cache expiration | # ---------------------------------------------------------------------- # Serve resources with far-future expiration date. # # (!) If you don't control versioning with filename-based # cache busting, you should consider lowering the cache times # to something like one week. # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires # https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires # No default expire rule. This config mirrors that of apache as outlined in the # html5-boilerplate .htaccess file. However, nginx applies rules by location, # the apache rules are defined by type. A consequence of this difference is that # if you use no file extension in the url and serve html, with apache you get an # expire time of 0s, with nginx you'd get an expire header of one month in the # future (if the default expire rule is 1 month). Therefore, do not use a # default expire rule with nginx unless your site is completely static # Documents location ~* \.(?:manifest|appcache|html?|xml|json)$ { expires 0; } # Feeds location ~* \.(?:rss|atom)$ { expires 1h; } # Media files location ~* \.(?:jpe?g|gif|png|ico|cur|gz|svgz?|mp4|og[gv]|web[pm]?|htc)$ { access_log off; expires 1M; } # Media: svgz files are already compressed. location ~* \.svgz$ { access_log off; gzip off; expires 1M; } # CSS and JavaScript location ~* \.(?:css|js)$ { access_log off; expires 1y; } # Web fonts location ~* \.(?:eot|otf|tt[cf]|woff2?)$ { access_log off; expires 1M; } # ---------------------------------------------------------------------- # | Cache file-descriptors | # ---------------------------------------------------------------------- # This tells nginx to cache open file handles, "not found" errors and # metadata about files and their permissions. # # Based on these cached metadata, nginx can immediately begin sending # data when a popular file is requested, and will also know to # immediately send a 404 if a file is missing on disk, and so on. # # (!) It also means that the server won't react immediately to changes # on disk, which may be undesirable. # As only metadata are cached, edited files may be troncated until # the cache is refreshed. # https://github.com/h5bp/server-configs-nginx/issues/203 # # In the below configuration, inactive files are released from the cache # after 20 seconds, whereas active (recently requested) files are # re-validated every 30 seconds. # Descriptors will not be cached unless they are used at least 2 times # within 20 seconds (the inactive time). # A maximum of the 1000 most recently used file descriptors can be # cached at any time. # # Production servers with stable file collections will definitely want # to enable the cache. # # https://nginx.org/en/docs/http/ngx_http_core_module.html#open_file_cache open_file_cache max=1000 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 2; open_file_cache_errors on;