Start
You only need to run the Nginx executable file directly.
[Gap@localhostsbin]$pwd/usr/local/nginx/sbin[gap@localhostsbin]$ Lltotal3208-rwxr-xr-x1Root root3283671Jan - +: -Nginx//Start Nginx[Gap@localhostsbin]$ sudo./nginx//view Nginx process[Gap@localhostsbin]$ Ps-ef|grep Nginxroot3022537270 A: -pts/0xx:xx:xxsudo./nginxroot3249710 at: -?xx:xx:xxNginx:master process./nginxnobody32499324970 at: -?xx:xx:xxNginx:worker Processgap3250437270 at: -pts/0xx:xx:xxgrep--Color=auto Nginx
Control
Once the Nginx is started, the program can be controlled using the-s parameter when the executable file is called. Use the following syntax:
-s signal
These signal can be values such as the following:
stop — 快速关闭quit — 优雅地关闭reload — 重新家在配置文件reopen — 重新打开日志文件
Stop it
For example, to wait for the worker process to process million current requests before exiting Nginx, but with the following command:
-s quit
This command must be executed using the user who launched Nginx.
Reload the configuration file
After modifying the configuration file, only the reload instruction is passed to the Nginx process or the nginx will be restarted to take effect.
Restart Nginx:
-s reload
Once the main process receives a signal to reload the configuration, it checks the syntax correctness of the new configuration file and attempts to apply the configuration information. If successful, the master process initiates a new worker process and sends messages to the old worker process, requiring them to close, otherwise the master process rolls back the modifications made and continues to work with the old configuration. The old worker process, receives the close command, stops accepting the new connection, continues processing the current request until all requests have been processed, and then the old worker process exits.
Other control methods
You can also send a signal to the nginx process with the help of a UNIX tool, such as the Kill tool. In this case, the signal is sent directly to the process of the specified ID. The ID of the Nginx master process is written by default to the Nginx.pid file, stored in the/usr/local/nginx/logs directory, or under the/var/run directory. For example, if the main process ID
When 1628, send the quit signal to let Nginx gracefully exit, execute:
-s1628
To get a running nginx process, use the PS tool, for example:
| grep nginx
To learn more about sending a signal to nginx, refer to the controlling Nginx section in the official documentation.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Nginx learning notes-start, stop, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.