2018-11-25 22:07:01 +01:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# | Cache file-descriptors |
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
2019-05-15 18:38:05 +02:00
|
|
|
# This tells Nginx to cache open file handles, "Not Found" errors and
|
2018-12-02 17:23:44 +01:00
|
|
|
# metadata about files and their permissions.
|
2013-02-24 22:13:09 +01:00
|
|
|
#
|
2019-05-15 18:38:05 +02:00
|
|
|
# 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.
|
2013-02-24 22:13:09 +01:00
|
|
|
#
|
2019-05-15 18:38:05 +02:00
|
|
|
# (!) 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 truncated until the cache
|
|
|
|
# is refreshed.
|
2018-12-02 17:23:44 +01:00
|
|
|
# https://github.com/h5bp/server-configs-nginx/issues/203
|
2013-02-24 22:13:09 +01:00
|
|
|
#
|
2019-05-15 18:38:05 +02:00
|
|
|
# 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.
|
2013-02-24 22:13:09 +01:00
|
|
|
#
|
2019-05-15 18:38:05 +02:00
|
|
|
# Production servers with stable file collections will definitely want to enable
|
|
|
|
# the cache.
|
2018-11-25 22:07:01 +01:00
|
|
|
#
|
2018-11-23 17:14:15 +01:00
|
|
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#open_file_cache
|
|
|
|
|
2018-11-25 22:07:01 +01:00
|
|
|
open_file_cache max=1000 inactive=20s;
|
|
|
|
open_file_cache_valid 30s;
|
2013-02-24 22:13:09 +01:00
|
|
|
open_file_cache_min_uses 2;
|
2018-11-25 22:07:01 +01:00
|
|
|
open_file_cache_errors on;
|