xref: /nginx/docs/man/nginx.8 (revision 7745:f57a478aa16d)
1.\"
2.\" Copyright (C) 2010, 2019 Sergey A. Osokin
3.\" Copyright (C) Nginx, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\"
28.Dd November 5, 2020
29.Dt NGINX 8
30.Os
31.Sh NAME
32.Nm nginx
33.Nd "HTTP and reverse proxy server, mail proxy server"
34.Sh SYNOPSIS
35.Nm
36.Op Fl ?hqTtVv
37.Op Fl c Ar file
38.Op Fl e Ar file
39.Op Fl g Ar directives
40.Op Fl p Ar prefix
41.Op Fl s Ar signal
42.Sh DESCRIPTION
43.Nm
44(pronounced
45.Dq engine x )
46is an HTTP and reverse proxy server, a mail proxy server, and a generic
47TCP/UDP proxy server.
48It is known for its high performance, stability, rich feature set, simple
49configuration, and low resource consumption.
50.Pp
51The options are as follows:
52.Bl -tag -width ".Fl d Ar directives"
53.It Fl ?\& , h
54Print help.
55.It Fl c Ar file
56Use an alternative configuration
57.Ar file .
58.It Fl e Ar file
59Use an alternative error log
60.Ar file .
61Special value
62.Cm stderr
63indicates that the standard error output should be used.
64.It Fl g Ar directives
65Set global configuration directives.
66See
67.Sx EXAMPLES
68for details.
69.It Fl p Ar prefix
70Set the prefix path.
71The default value is
72.Pa %%PREFIX%% .
73.It Fl q
74Suppress non-error messages during configuration testing.
75.It Fl s Ar signal
76Send a signal to the master process.
77The argument
78.Ar signal
79can be one of:
80.Cm stop , quit , reopen , reload .
81The following table shows the corresponding system signals:
82.Pp
83.Bl -tag -width ".Cm reopen" -compact
84.It Cm stop
85.Dv SIGTERM
86.It Cm quit
87.Dv SIGQUIT
88.It Cm reopen
89.Dv SIGUSR1
90.It Cm reload
91.Dv SIGHUP
92.El
93.It Fl T
94Same as
95.Fl t ,
96but additionally dump configuration files to standard output.
97.It Fl t
98Do not run, just test the configuration file.
99.Nm
100checks the configuration file syntax and then tries to open files
101referenced in the configuration file.
102.It Fl V
103Print the
104.Nm
105version, compiler version, and
106.Pa configure
107script parameters.
108.It Fl v
109Print the
110.Nm
111version.
112.El
113.Sh SIGNALS
114The master process of
115.Nm
116can handle the following signals:
117.Pp
118.Bl -tag -width ".Dv SIGINT , SIGTERM" -compact
119.It Dv SIGINT , SIGTERM
120Shut down quickly.
121.It Dv SIGHUP
122Reload configuration, start the new worker process with a new
123configuration, and gracefully shut down old worker processes.
124.It Dv SIGQUIT
125Shut down gracefully.
126.It Dv SIGUSR1
127Reopen log files.
128.It Dv SIGUSR2
129Upgrade the
130.Nm
131executable on the fly.
132.It Dv SIGWINCH
133Shut down worker processes gracefully.
134.El
135.Pp
136While there is no need to explicitly control worker processes normally,
137they support some signals too:
138.Pp
139.Bl -tag -width ".Dv SIGINT , SIGTERM" -compact
140.It Dv SIGTERM
141Shut down quickly.
142.It Dv SIGQUIT
143Shut down gracefully.
144.It Dv SIGUSR1
145Reopen log files.
146.El
147.Sh DEBUGGING LOG
148To enable a debugging log, reconfigure
149.Nm
150to build with debugging:
151.Pp
152.Dl "./configure --with-debug ..."
153.Pp
154and then set the
155.Cm debug
156level of the
157.Va error_log :
158.Pp
159.Dl "error_log /path/to/log debug;"
160.Pp
161It is also possible to enable the debugging for a particular IP address:
162.Bd -literal -offset indent
163events {
164	debug_connection 127.0.0.1;
165}
166.Ed
167.Sh ENVIRONMENT
168The
169.Ev NGINX
170environment variable is used internally by
171.Nm
172and should not be set directly by the user.
173.Sh FILES
174.Bl -tag -width indent
175.It Pa %%PID_PATH%%
176Contains the process ID of
177.Nm .
178The contents of this file are not sensitive, so it can be world-readable.
179.It Pa %%CONF_PATH%%
180The main configuration file.
181.It Pa %%ERROR_LOG_PATH%%
182Error log file.
183.El
184.Sh EXIT STATUS
185Exit status is 0 on success, or 1 if the command fails.
186.Sh EXAMPLES
187Test configuration file
188.Pa ~/mynginx.conf
189with global directives for PID and quantity of worker processes:
190.Bd -literal -offset indent
191nginx -t -c ~/mynginx.conf \e
192	-g "pid /var/run/mynginx.pid; worker_processes 2;"
193.Ed
194.Sh SEE ALSO
195.\"Xr nginx.conf 5
196.\"Pp
197Documentation at
198.Pa http://nginx.org/en/docs/ .
199.Pp
200For questions and technical support, please refer to
201.Pa http://nginx.org/en/support.html .
202.Sh HISTORY
203Development of
204.Nm
205started in 2002, with the first public release on October 4, 2004.
206.Sh AUTHORS
207.An -nosplit
208.An Igor Sysoev Aq Mt igor@sysoev.ru .
209.Pp
210This manual page was originally written by
211.An Sergey A. Osokin Aq Mt osa@FreeBSD.org.ru
212as a result of compiling many
213.Nm
214documents from all over the world.
215