Mastering Nginx

(Ron) #1

Reverse Proxy Advanced Topics


[ 106 ]

Directive Explanation
proxy_cache_path A directory in which to place the cached
responses and a shared memory zone
(keys_zone=name:size) to store active
keys and response metadata. Optional
parameters are:


  • levels: Colon-separated length of
    subdirectory name at each level (1 or
    2), maximum of three levels deep

  • inactive: The maximum length of
    time an inactive response stays in the
    cache before being ejected

  • max_size: The maximum size of
    the cache; when the size exceeds
    this value, a cache manager process
    removes the least recently used items

  • loader_files: The maximum
    number of cached files whose
    metadata are loaded per iteration of
    the cache loader process

  • loader_sleep: The number of
    milliseconds paused between each
    iteration of the cache loader process

  • loader_threshold: The maximum
    length of time a cache loader iteration
    may take
    proxy_cache_use_stale The cases under which it is acceptable to
    serve stale cached data when an error occurs
    while accessing the upstream server. The
    updating parameter indicates the case
    when fresh data are being loaded.
    proxy_cache_valid Indicates the length of time for which a
    cached response with response code 200,
    301, or 302 is valid. If an optional response
    code is given before the time parameter,
    that time is only for that response code. The
    special parameter any indicates that any
    response code should be cached for that
    length of time.

Free download pdf