HTTP directives

open_file_cache directive (HTTP)

Cache filesystem lookup information and open descriptors, not HTTP response bodies. Use a small bound for a static-site lab. Context: http, server, location. Documented default: off. Version: Introduction not established. OSS documentation; check target build. Lookup error caching is separately controlled; consider stale metadata after deployment. Example is a partial http configuration fragment; use a disposable lab, not a production tuning prescription.

Formal Syntax & Structure

nginx syntaxnginx
open_file_cache off | max=N [inactive=time];

Parameters & Attributes

NameTypeDescription
mode_or_maxoff | max=positive integerDisable or cap the number of entries.
inactiveinactive=durationRemove entries after inactivity; default 60s when enabled.

Working Example

Example Snippetnginx
open_file_cache max=128 inactive=45s;
Nginx Reference