<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
<article name="Command-line parameters"
link="/en/docs/switches.html"
lang="en"
rev="4">
<section>
<para>
nginx supports the following command-line parameters:
<list type="bullet">
<listitem>
<literal>-?</literal> | <literal>-h</literal>—print help
for command-line parameters.
</listitem>
<listitem>
<literal>-c <value>file</value></literal>—use an alternative
configuration <value>file</value> instead of a default file.
</listitem>
<listitem>
<literal>-e <value>file</value></literal>—use an alternative
error log <value>file</value> to store the log
instead of a default file (1.19.5).
The special value <literal>stderr</literal> selects the standard error file.
</listitem>
<listitem>
<literal>-g <value>directives</value></literal>—set
<link doc="ngx_core_module.xml">global configuration directives</link>,
for example,
<programlisting>
nginx -g "pid /var/run/nginx.pid; worker_processes `sysctl -n hw.ncpu`;"
</programlisting>
</listitem>
<listitem id="l">
<literal>-l <value>port</value></literal>—enable
<link url="https://docs.nginx.com/nginx/admin-guide/basic-functionality/runtime-control#control-api">nginx control REST API</link>
on a specified <value>port</value> or UNIX-domain socket (1.29.8).
<para>
<note>
This parameter is available as part of our
<commercial_version>commercial subscription</commercial_version>.
</note>
</para>
</listitem>
<listitem>
<literal>-p <value>prefix</value></literal>—set nginx path prefix,
i.e. a directory that will keep server files
(default value is <value>/usr/local/nginx</value>).
</listitem>
<listitem>
<literal>-q</literal>—suppress non-error messages
during configuration testing.
</listitem>
<listitem>
<literal>-s <value>signal</value></literal>—send a <i>signal</i>
to the master process.
The argument <i>signal</i> can be one of:
<list type="bullet">
<listitem>
<literal>stop</literal>—shut down quickly
</listitem>
<listitem>
<literal>quit</literal>—shut down gracefully
</listitem>
<listitem>
<literal>reload</literal>—reload configuration,
start the new worker process with a new configuration,
gracefully shut down old worker processes.
</listitem>
<listitem>
<literal>reopen</literal>—reopen log files
</listitem>
</list>
</listitem>
<listitem>
<literal>-t</literal>—test the configuration file: nginx checks the
configuration for correct syntax, and then tries to open files
referred in the configuration.
</listitem>
<listitem>
<literal>-T</literal>—same as <literal>-t</literal>,
but additionally dump configuration files to standard output (1.9.2).
</listitem>
<listitem>
<literal>-v</literal>—print nginx version.
</listitem>
<listitem>
<literal>-V</literal>—print nginx version, compiler version,
and configure parameters.
</listitem>
</list>
</para>
</section>
</article>