Mastering Nginx

(Ron) #1

The NGINX HTTP Server


[ 120 ]

The following table describes the directives used in the preceding code:


Table: HTTP logging directives

Directive Explanation
access_log Describes where and how access logs are to
be written. The first parameter is a path to the
file where the logs are to be stored. Variables
may be used in constructing the path. The
special value off disables the access log.
An optional second parameter indicates
log_format that will be used to write the
logs. If no second parameter is configured,
the predefined combined format is used. An
optional third parameter indicates the size of
the buffer if write buffering should be used
to record the logs. If write buffering is used,
this size cannot exceed the size of the atomic
disk write for that filesystem. If this third
parameter is gzip, then the buffered logs
will be compressed on-the-fly, provided that
the nginx binary was built with the zlib
library. A final flush parameter indicates
the maximum length of time buffered log
data may remain in memory before being
flushed to disk.
log_format Specifies which fields should appear in the
log file and what format they should take.
See the next table for a description of the
log-specific variables.
log_not_found Disables reporting of 404 errors in the error
log (default value is on).
log_subrequest Enables logging of subrequests in the access
log (default value is off).
open_log_file_cache Stores a cache of open file descriptors used
in access_logs with a variable in the
path. The parameters used are:


  • max: The maximum number of file
    descriptors present in the cache

  • inactive: NGINX will wait this
    amount of time for something to
    be written to this log before its file
    descriptor is closed

Free download pdf