log_format

Syntax: log_format name [escape=default|json] string ...; Default: — Context: stream Specifies the log format, for example: log_format proxy '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; The escape parameter (1.11.8) allows setting json or default characters escaping in va

Logging to syslog

Logging to syslog The error_log and access_log directives support logging to syslog. The following parameters configure logging to syslog: server=address Defines the address of a syslog server. The address can be specified as a domain name or IP address, with an optional port, or as a UNIX-domain socket path specified after the “unix:” prefix. If port is not specified, the UDP port 514 is used. If a domain name resolves to several IP addresses, the first resolved address is used. facilit

lock_file

Syntax: lock_file file; Default: lock_file logs/nginx.lock; Context: main nginx uses the locking mechanism to implement accept_mutex and serialize access to shared memory. On most systems the locks are implemented using atomic operations, and this directive is ignored. On other systems the “lock file” mechanism is used. This directive specifies a prefix for the names of lock files.

location

Syntax: location [ = | ~ | ~* | ^~ ] uri { ... }location @name { ... } Default: — Context: server, location Sets configuration depending on a request URI. The matching is performed against a normalized URI, after decoding the text encoded in the “%XX” form, resolving references to relative path components “.” and “..”, and possible compression of two or more adjacent slashes into a single slash. A location can either be defined by a prefix string, or by a re

load_module

Syntax: load_module file; Default: — Context: main This directive appeared in version 1.9.11. Loads a dynamic module. Example: load_module modules/ngx_mail_module.so;

listen

Syntax: listen address:port [ssl] [udp] [proxy_protocol] [backlog=number] [bind] [ipv6only=on|off] [reuseport] [so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt]]; Default: — Context: server Sets the address and port for the socket on which the server will accept connections. It is possible to specify just the port. The address can also be a hostname, for example: listen 127.0.0.1:12345; listen *:12345; listen 12345; # same as *:12345 l

listen

Syntax: listen address:port [ssl] [backlog=number] [bind] [ipv6only=on|off] [so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt]]; Default: — Context: server Sets the address and port for the socket on which the server will accept requests. It is possible to specify just the port. The address can also be a hostname, for example: listen 127.0.0.1:110; listen *:110; listen 110; # same as *:110 listen localhost:110; IPv6 addresses (0.7.58) are specifi

listen

Syntax: listen address[:port] [default_server] [ssl] [http2 | spdy] [proxy_protocol] [setfib=number] [fastopen=number] [backlog=number] [rcvbuf=size] [sndbuf=size] [accept_filter=filter] [deferred] [bind] [ipv6only=on|off] [reuseport] [so_keepalive=on|off|[keepidle]:[keepintvl]:[keepcnt]];listen port [default_server] [ssl] [http2 | spdy] [proxy_protocol] [setfib=number] [fastopen=number] [backlo

lingering_timeout

Syntax: lingering_timeout time; Default: lingering_timeout 5s; Context: http, server, location When lingering_close is in effect, this directive specifies the maximum waiting time for more client data to arrive. If data are not received during this time, the connection is closed. Otherwise, the data are read and ignored, and nginx starts waiting for more data again. The “wait-read-ignore” cycle is repeated, but no longer than specified by the lingering_time directive.

lingering_close

Syntax: lingering_close off | on | always; Default: lingering_close on; Context: http, server, location This directive appeared in versions 1.1.0 and 1.0.6. Controls how nginx closes client connections. The default value “on” instructs nginx to wait for and process additional data from a client before fully closing a connection, but only if heuristics suggests that a client may be sending more data. The value “always” will cause nginx to unconditionally wait for