原文地址:http://nginx.com/resources/admin-guide/processes-and-runtime-control/
Processes and Runtime Control
进程和实时控制
This section describes the processes NGINX starts at run time and how to control them.
本文讨论Nginx开始运行时的进程以及如何控制这些进程。
Master and Worker Processes
主进程和工作进程
NGINX has one master process and one or more worker processes. If caching is enabled, the cache loader and cache manager processes will also run.
Nginx 有一个主进程和至少一个工作进程。如果缓存开启,缓存加载器和缓存管理器进程也会运行。
The main purpose of the master process is to read and evaluate configuration files, as well as, maintaining worker processes.
主进程的主要工作就是读取和评估配置文件,同时操作工作进程。
The Worker processes do the actual processing of requests. NGINX relies on OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the nginx.conf file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores (see worker_processes).
工作进程直接处理请求。Nginx依赖操作系统机制均衡地把请求分发到各工作进程。工作进程和数量在nginx.conf文件中定义,当然也可以设置为自动来根据可用的CPU内核进程调整(见worker_processes)。
Controlling nginx
控制Nginx
To reload your configuration, you can stop, or restart nginx, or send signals to the master process. A signal can be sent by running the NGINX executable with the -s parameter.
要重加加载你的配置,你可以停止,或者重启Nginx,或者发送一个信号给主进程。运行nginx并带着-s参数能发送一个信号给Nginx主进程。
When us -s the signal parameter may be one of the following:
-s 后接的信号参数为以下其中一个:
-
stop — fast shutdown 快速关闭
-
quit — graceful shutdown 优雅关闭
-
reopen — reopening the log files 重启日志文件
-
reload — reloading the configuration file 重加载配置文件
A signal can also be sent directly to the master process with the use of the kill utility. The process ID of the master process is written, by default, to the nginx.pid file, which is located in the /usr/local/nginx/logs or /var/run directory.
一个信号也可能直接使用kill工具发送给主进程。需要用到主进程的进程号,默认的在nginx.pid文件中,该文件可能放在/usr/local/nginx/logs或者/var/run目录下。
You can read more about advanced signals like log file reopening and live binary upgrades in the Controlling NGINX documentation.
你可以在 Controlling NGINX documentation 里找到更多的可用信号,例如重启日志文件和运行时二进制升级。
(责任编辑:IT) |