1. Core functions
1.1. error_log
Reference: https://www.yuque.com/heyingsheng/czqomy/snan44#Aiptd
1.2. include
Directive
Syntax: include file|mask ;
Default: Close
Context: any
Instroduction
Includes another file, or files matching the specified mask, into configuration. Included files should consist of syntactically correct directives and blocks.
1.3. pid
Directive
Syntax: pid file ;
Default: pid logs/nginx.pid ;
Context: main
Instroduction
Specify a file to save master process pid.
1.4. user
Directive
Syntax: user username [group] ;
Default: user nobody nobody ;
Context: main
Instroduction
Defines user and group that owner of worker processes.If group is omitted,a group whose name equals that of user is used.
1.5. worker_proess
Directive
Syntax: worker_process number|auto ;
Default: worker_process 1 ;
Context: main
Instroduction
Set number of worker process.The better number is not large than CPU cores(# lscpu).The value equal to CPU cores when sets auto.
1.6. worker_priority
Directive
Syntax: worker_priority number ;
Default: worker_priority 0;
Context: main
Instroduction
Sets CPU task scheduling priority for worker process(like nice command),the value from -20 ~ 20.The negative means high priority.
1.7. worker_cpu_affinity
Directive
Syntax: worker_cpu_affinity cpumask ... | auto ;
Default: Close
Context: main
Instroduction
Binds worker process to the sets of CPU cores,usually auto is best choice.For example:
worker_process 4 ;
worker_cpu_affinity 0001 0010 0100 1000 ;
1.8. worker_rlimit_nofile
Directive
Syntax: worker_rlimit_nofile number ;
Default: Close
Context: main
Instroduction
Changes the limit on the maximum number of open files for worker processes.Used to increase the limit without restaring the mian process.
1.9. event
Directive
Syntax: event {...}
Default:
Context: main
Instroduction
Provides the configuration file context in which the directives that affect connection processing are specified.
1.10. use
Directive
Syntax: use methon ;
Default: Close
Context: events
Instroduction
Specifies the connection processing method to use. There is normally no need to specify it explicitly, because nginx will by default use the most efficient method. However we set use epoll method.
2. http_core_module
2.1. limit_except
Directive
Syntax: limit_except method ... {} ;
Default: Close ;
Context: location
Instroduction
Limits allowed HTTP methods inside a location. The method parameter can be one of the following: GET, HEAD, POST, PUT, DELETE, MKCOL, COPY, MOVE, OPTIONS, PROPFIND, PROPPATCH, LOCK, UNLOCK, or PATCH. Allowing the GET method makes the HEAD method also allowed.
2.2. merge_slashes
Directive
Syntax: merge_slashes on | off ;
Default: merge_slashes on ;
Context: http,server
Instroduction
Enables
or disables compression of two or more adjacent slashes(/) in a URI into a
single slash.Compress more than one / to one / .
Turning the compression off can become
necessary if a URI contains base64-encoded names, since base64 uses the “/” character
internally.
If
the directive is specified on the server level, its value is only used if a
server is a default one. The value specified also applies to all virtual
servers listening on the same address and port.
2.3. server_tokens
Directive
Syntax: server_tokens on|off|build|string ;
Default: server_tokens on ;
Context: http,server,location
Instroduction
Enable
or disable nginx version on error page and response header.
Parameters:
- on : enable nginx version
- off: only show server type like nignx,disable nginx version
- build: show server name when build name when ./configure.
- string: commercial subscription configuration.