Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nginx
GitHub Repository: nginx/nginx.org
Path: blob/main/xml/en/docs/switches.xml
1 views
1
<!--
2
Copyright (C) Igor Sysoev
3
Copyright (C) Nginx, Inc.
4
-->
5
6
<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
7
8
<article name="Command-line parameters"
9
link="/en/docs/switches.html"
10
lang="en"
11
rev="4">
12
13
<section>
14
15
<para>
16
nginx supports the following command-line parameters:
17
<list type="bullet">
18
19
<listitem>
20
<literal>-?</literal> | <literal>-h</literal>&mdash;print help
21
for command-line parameters.
22
</listitem>
23
24
<listitem>
25
<literal>-c <value>file</value></literal>&mdash;use an alternative
26
configuration <value>file</value> instead of a default file.
27
</listitem>
28
29
<listitem>
30
<literal>-e <value>file</value></literal>&mdash;use an alternative
31
error log <value>file</value> to store the log
32
instead of a default file (1.19.5).
33
The special value <literal>stderr</literal> selects the standard error file.
34
</listitem>
35
36
<listitem>
37
<literal>-g <value>directives</value></literal>&mdash;set
38
<link doc="ngx_core_module.xml">global configuration directives</link>,
39
for example,
40
<programlisting>
41
nginx -g "pid /var/run/nginx.pid; worker_processes `sysctl -n hw.ncpu`;"
42
</programlisting>
43
</listitem>
44
45
<listitem id="l">
46
<literal>-l <value>port</value></literal>&mdash;enable
47
<link url="https://docs.nginx.com/nginx/admin-guide/basic-functionality/runtime-control#control-api">nginx control REST API</link>
48
on a specified <value>port</value> or UNIX-domain socket (1.29.8).
49
<para>
50
<note>
51
This parameter is available as part of our
52
<commercial_version>commercial subscription</commercial_version>.
53
</note>
54
</para>
55
</listitem>
56
57
<listitem>
58
<literal>-p <value>prefix</value></literal>&mdash;set nginx path prefix,
59
i.e. a directory that will keep server files
60
(default value is <value>/usr/local/nginx</value>).
61
</listitem>
62
63
<listitem>
64
<literal>-q</literal>&mdash;suppress non-error messages
65
during configuration testing.
66
</listitem>
67
68
<listitem>
69
<literal>-s <value>signal</value></literal>&mdash;send a <i>signal</i>
70
to the master process.
71
The argument <i>signal</i> can be one of:
72
<list type="bullet">
73
<listitem>
74
<literal>stop</literal>&mdash;shut down quickly
75
</listitem>
76
<listitem>
77
<literal>quit</literal>&mdash;shut down gracefully
78
</listitem>
79
<listitem>
80
<literal>reload</literal>&mdash;reload configuration,
81
start the new worker process with a new configuration,
82
gracefully shut down old worker processes.
83
</listitem>
84
<listitem>
85
<literal>reopen</literal>&mdash;reopen log files
86
</listitem>
87
</list>
88
</listitem>
89
90
<listitem>
91
<literal>-t</literal>&mdash;test the configuration file: nginx checks the
92
configuration for correct syntax, and then tries to open files
93
referred in the configuration.
94
</listitem>
95
96
<listitem>
97
<literal>-T</literal>&mdash;same as <literal>-t</literal>,
98
but additionally dump configuration files to standard output (1.9.2).
99
</listitem>
100
101
<listitem>
102
<literal>-v</literal>&mdash;print nginx version.
103
</listitem>
104
105
<listitem>
106
<literal>-V</literal>&mdash;print nginx version, compiler version,
107
and configure parameters.
108
</listitem>
109
110
</list>
111
</para>
112
113
</section>
114
115
</article>
116
117