Nginx process and real-time control, nginx process real-time control

Source: Internet
Author: User

Nginx process and real-time control, nginx process real-time control

Address: http://nginx.com/resources/admin-guide/processes-and-runtime-control/

Processes and Runtime Control
Process and Real-time Control


This section describes the processes NGINX starts at run time and how to control them.

This article discusses the processes when Nginx starts running and how to control these processes.

Master and Worker Processes
Main process and working process

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 has a master process and at least one working process. If the cache is enabled, the cache loader and the cache manager process also run.

The main purpose of the master process is to read and evaluate configuration files, as well as, maintaining worker processes.

The main task of the main process is to read and evaluate the configuration file and operate the working process at the same time.

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 ).

The Worker Process processes the request directly. Nginx relies on the operating system mechanism to evenly distribute requests to various working processes. The Worker Process and quantity are defined in the nginx. conf file. Of course, you can also set it to automatically adjust it according to the available CPU kernel process (see worker_processes ).

Controlling nginx
Control 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.

To re-load your configuration, you can stop, restart Nginx, or send a signal to the main process. Run nginx and send a signal with the-s parameter to the main Nginx process.

nginx -s signal

When us-sSignalParameter may be one of the following:

-S is followed by one of the following signal parameters:

  • Stop-fast shutdown
  • Quit-graceful shutdown elegant shutdown
  • Reopen-reopening the log files restart the log file
  • Reload-reloading the configuration file reload 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.

A signal may also be sent directly to the main process using the kill tool. The process ID of the main process is required. The default value is in the nginx. pid file. This file may be stored in the/usr/local/nginx/logs or/var/run directory.

You can read more about advanced signals like log file reopening and live binary upgrades in the Controlling NGINX documentation.

You can find more available signals in Controlling NGINX documentation, such as restarting log files and binary upgrades during runtime.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.