| <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Core Module</title></head><body><center><h3>Core Module</h3></center><a name="example"></a><center><h4>Example Configuration</h4></center><p><blockquote><pre> |
| user www www; |
| worker_processes 2; |
| |
| error_log /var/log/nginx-error.log info; |
| |
| events { |
| use kqueue; |
| worker_connections 2048; |
| } |
| |
| ... |
| </pre></blockquote></p><a name="directives"></a><center><h4>Directives</h4></center><hr><a name="daemon"></a><strong>syntax</strong>: |
| <code>daemon <code>on</code> | <code>off</code></code><br><strong>default</strong>: |
| <code>daemon on</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Determines whether nginx should become a daemon. |
| Mainly used during development. |
| </p><hr><a name="env"></a><strong>syntax</strong>: |
| <code>env <code><i>VAR</i></code>[=<code><i>VALUE</i></code>]</code><br><strong>default</strong>: |
| <code>env TZ</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Allows to limit a set of environment variables, change their values, |
| or create new environment variables, for the following cases: |
| <ul><li> |
| variable inheritance during a |
| <a href="control.html#upgrade">live upgrade</a> |
| of an executable file; |
| </li><li> |
| use of variables by the module |
| <a href="http/ngx_http_perl_module.html">ngx_http_perl_module</a>; |
| </li><li> |
| use of variables by worker processes. |
| Please bear in mind that controlling system libraries in this way |
| is not always possible as it is not uncommon for libraries to check |
| variables only during initialization, well before they can be set |
| using this directive. |
| An exception from this is an above mentioned |
| <a href="control.html#upgrade">live upgrade</a> |
| of an executable file. |
| </li></ul></p><p> |
| The TZ variable is always inherited and made available to the module |
| <a href="http/ngx_http_perl_module.html">ngx_http_perl_module</a>, |
| unless configured explicitly. |
| </p><p> |
| Usage example: |
| <blockquote><pre> |
| env MALLOC_OPTIONS; |
| env PERL5LIB=/data/site/modules; |
| env OPENSSL_ALLOW_PROXY_CERTS=1; |
| </pre></blockquote></p><hr><a name="include"></a><strong>syntax</strong>: |
| <code>include <code><i>file</i></code> | <code><i>mask</i></code></code><br><strong>default</strong>: |
| <strong>none</strong><br><strong>context</strong>: |
| <strong>any</strong><br><p> |
| Includes another <code><i>file</i></code>, or files matching the |
| specified <code><i>mask</i></code>, into configuration. |
| Included files should consist of |
| syntactically correct directives and blocks. |
| </p><p> |
| Usage example: |
| <blockquote><pre> |
| include mime.types; |
| include vhosts/*.conf; |
| </pre></blockquote></p><hr><a name="master_process"></a><strong>syntax</strong>: |
| <code>master_process <code>on</code> | <code>off</code></code><br><strong>default</strong>: |
| <code>master_process on</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Determines whether worker processes are started. |
| This directive is intended for nginx developers. |
| </p><hr><a name="pid"></a><strong>syntax</strong>: |
| <code>pid <code><i>file</i></code></code><br><strong>default</strong>: |
| <code>pid nginx.pid</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Defines a <code><i>file</i></code> which will store the process ID of the main process. |
| </p><hr><a name="ssl_engine"></a><strong>syntax</strong>: |
| <code>ssl_engine <code><i>device</i></code></code><br><strong>default</strong>: |
| <strong>none</strong><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Defines the name of the hardware SSL accelerator. |
| </p><hr><a name="user"></a><strong>syntax</strong>: |
| <code>user <code><i>user</i></code> [<code><i>group</i></code>]</code><br><strong>default</strong>: |
| <code>user nobody nobody</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Defines <code><i>user</i></code> and <code><i>group</i></code> |
| credentials used by worker processes. |
| If <code><i>group</i></code> is omitted, a group whose name equals |
| that of <code><i>user</i></code> is used. |
| </p><hr><a name="timer_resolution"></a><strong>syntax</strong>: |
| <code>timer_resolution <code><i>interval</i></code></code><br><strong>default</strong>: |
| <strong>none</strong><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Reduces timer resolution in worker processes, thus reducing the |
| number of <code>gettimeofday()</code> system calls made. |
| By default, <code>gettimeofday()</code> is called each time |
| on receiving a kernel event. |
| With reduced resolution, <code>gettimeofday()</code> is only |
| called once per specified <code><i>interval</i></code>. |
| </p><p> |
| Example: |
| <blockquote><pre> |
| timer_resolution 100ms; |
| </pre></blockquote></p><p> |
| An internal implementation of interval depends on the method used: |
| <ul><li> |
| an <code>EVFILT_TIMER</code> filter if <code>kqueue</code> is used; |
| </li><li><code>timer_create()</code> if <code>eventport</code> is used; |
| </li><li><code>setitimer()</code> otherwise. |
| </li></ul></p><hr><a name="worker_rlimit_core"></a><strong>syntax</strong>: |
| <code>worker_rlimit_core <code><i>size</i></code></code><br><strong>default</strong>: |
| <strong>none</strong><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Changes the limit on the largest size of a core file |
| (<code>RLIMIT_CORE</code>) for worker processes. |
| Used to increase the limit without restarting the main process. |
| </p><hr><a name="worker_rlimit_nofile"></a><strong>syntax</strong>: |
| <code>worker_rlimit_nofile <code><i>number</i></code></code><br><strong>default</strong>: |
| <strong>none</strong><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Changes the limit on the maximum number of open files |
| (<code>RLIMIT_NOFILE</code>) for worker processes. |
| Used to increase the limit without restarting the main process. |
| </p><hr><a name="worker_priority"></a><strong>syntax</strong>: |
| <code>worker_priority <code><i>number</i></code></code><br><strong>default</strong>: |
| <code>worker_priority 0</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Defines a scheduling priority for worker processes like is |
| done by the <code>nice</code>: a negative |
| <code><i>number</i></code> |
| means higher priority. |
| Allowed range normally varies from -20 to 20. |
| </p><p> |
| Example: |
| <blockquote><pre> |
| worker_priority -10; |
| </pre></blockquote></p><hr><a name="worker_processes"></a><strong>syntax</strong>: |
| <code>worker_processes <code><i>number</i></code></code><br><strong>default</strong>: |
| <code>worker_processes 1</code><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Defines the number of worker processes. |
| </p><hr><a name="working_directory"></a><strong>syntax</strong>: |
| <code>working_directory <code><i>directory</i></code></code><br><strong>default</strong>: |
| <strong>none</strong><br><strong>context</strong>: |
| <code>main</code><br><p> |
| Defines a current working directory for a worker process. |
| It is primarily used when writing a core-file, in which case |
| a working process should have write permission for the |
| specified directory. |
| </p></body></html> |