summaryrefslogtreecommitdiffhomepage
path: root/docs/xml/ngx_core_module.xml
blob: 6cd6a1ef9f2e23f13d88af63bfa6db7b7ad468f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<?xml version="1.0"?>

<!DOCTYPE module SYSTEM "../dtd/module.dtd">

<module name="Core Module" id="core_module">

<section id="example" name="Example Configuration">

<para>
<example>
user www www;
worker_processes 2;

error_log /var/log/nginx-error.log info;

events {
    use kqueue;
    worker_connections 2048;
}

...
</example>
</para>

</section>


<section id="directives" name="Directives">

<directive name="daemon">
<syntax>daemon <value>on</value> | <value>off</value></syntax>
<default>daemon on</default>
<context>main</context>

<para>
Determines whether nginx should become a daemon.
Mainly used during development.
</para>

</directive>


<directive name="env">
<syntax>env <argument>VAR</argument>[=<argument>VALUE</argument>]</syntax>
<default>env TZ</default>
<context>main</context>

<para>
Allows to limit a set of environment variables, change their values,
or create new environment variables, for the following cases:
<list type="bullet">

<listitem>
variable inheritance during a
<link doc="control.xml" id="upgrade">live upgrade</link>
of an executable file;
</listitem>

<listitem>
use of variables by the module
<link doc="http/ngx_http_perl_module.xml">ngx_http_perl_module</link>;
</listitem>

<listitem>
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
<link doc="control.xml" id="upgrade">live upgrade</link>
of an executable file.
</listitem>

</list>
</para>

<para>
The TZ variable is always inherited and made available to the module
<link doc="http/ngx_http_perl_module.xml">ngx_http_perl_module</link>,
unless configured explicitly.
</para>

<para>
Usage example:
<example>
env MALLOC_OPTIONS;
env PERL5LIB=/data/site/modules;
env OPENSSL_ALLOW_PROXY_CERTS=1;
</example>
</para>

</directive>

<directive name="include">
<syntax>include <argument>file</argument> | <argument>mask</argument></syntax>
<default/>
<context/>

<para>
Includes another <argument>file</argument>, or files matching the
specified <argument>mask</argument>, into configuration.
Included files should consist of
syntactically correct directives and blocks.
</para>

<para>
Usage example:
<example>
include mime.types;
include vhosts/*.conf;
</example>
</para>

</directive>


<directive name="master_process">
<syntax>master_process <value>on</value> | <value>off</value></syntax>
<default>master_process on</default>
<context>main</context>

<para>
Determines whether worker processes are started.
This directive is intended for nginx developers.
</para>

</directive>


<directive name="pid">
<syntax>pid <argument>file</argument></syntax>
<default>pid nginx.pid</default>
<context>main</context>

<para>
Defines a <argument>file</argument> which will store the process ID of the main process.
</para>

</directive>


<directive name="ssl_engine">
<syntax>ssl_engine <argument>device</argument></syntax>
<default/>
<context>main</context>

<para>
Defines the name of the hardware SSL accelerator.
</para>

</directive>


<directive name="user">
<syntax>user <argument>user</argument> [<argument>group</argument>]</syntax>
<default>user nobody nobody</default>
<context>main</context>

<para>
Defines <argument>user</argument> and <argument>group</argument>
credentials used by worker processes.
If <argument>group</argument> is omitted, a group whose name equals
that of <argument>user</argument> is used.
</para>

</directive>


<directive name="timer_resolution">
<syntax>timer_resolution <argument>interval</argument></syntax>
<default/>
<context>main</context>

<para>
Reduces timer resolution in worker processes, thus reducing the
number of <c-func>gettimeofday</c-func> system calls made.
By default, <c-func>gettimeofday</c-func> is called each time
on receiving a kernel event.
With reduced resolution, <c-func>gettimeofday</c-func> is only
called once per specified <argument>interval</argument>.
</para>

<para>
Example:
<example>
timer_resolution 100ms;
</example>
</para>

<para>
An internal implementation of interval depends on the method used:
<list type="bullet">

<listitem>
an <c-def>EVFILT_TIMER</c-def> filter if <value>kqueue</value> is used;
</listitem>

<listitem>
<c-func>timer_create</c-func> if <value>eventport</value> is used;
</listitem>

<listitem>
<c-func>setitimer</c-func> otherwise.
</listitem>

</list>
</para>

</directive>


<directive name="worker_rlimit_core">
<syntax>worker_rlimit_core <argument>size</argument></syntax>
<default/>
<context>main</context>

<para>
Changes the limit on the largest size of a core file
(<c-def>RLIMIT_CORE</c-def>) for worker processes.
Used to increase the limit without restarting the main process.
</para>

</directive>


<directive name="worker_rlimit_nofile">
<syntax>worker_rlimit_nofile <argument>number</argument></syntax>
<default/>
<context>main</context>

<para>
Changes the limit on the maximum number of open files
(<c-def>RLIMIT_NOFILE</c-def>) for worker processes.
Used to increase the limit without restarting the main process.
</para>

</directive>


<directive name="worker_priority">
<syntax>worker_priority <argument>number</argument></syntax>
<default>worker_priority 0</default>
<context>main</context>

<para>
Defines a scheduling priority for worker processes like is
done by the <command>nice</command>: a negative
<argument>number</argument>
means higher priority.
Allowed range normally varies from -20 to 20.
</para>

<para>
Example:
<example>
worker_priority -10;
</example>
</para>

</directive>


<directive name="worker_processes">
<syntax>worker_processes <argument>number</argument></syntax>
<default>worker_processes 1</default>
<context>main</context>

<para>
Defines the number of worker processes.
</para>

</directive>


<directive name="working_directory">
<syntax>working_directory <argument>directory</argument></syntax>
<default/>
<context>main</context>

<para>
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.
</para>

</directive>

</section>

</module>