nginx has one master process and several worker processes. The main purpose of the master process is to read and evaluate configuration, and maintain worker processes. Worker processes do actual processing of requests. nginxemploys eventer mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically.
The way nginx and its modules work is determined in the configuration file. By default, the configuration file is named nginx.conf and placed in the directory /usr/local/nginx/conf, /etc/nginx, local. /etc/nginx.
以下內容為nginx啟動,關the executable with the
-snginx -s <em>signal</em>
Where signal
may be 38 the folloWhere
quit
— graceful shutdown
reload
reopen
For example, to stop nginx process with procesd ed:nginx -s quit
This command should be executed under the same user that started nginx. <pre class="brush:php;toolbar:false">nginx -s reload
</pre>
一旦啟動了nginx,就可以透過其中nginx -s [signal]命令的方式來控制其中包括signalinx.可以以下的指令:stop
quit
— 重新開啟日誌檔案例如,等待worker進程處理完目前請求後再關閉nginx,可以使用
nginx -s quit
nginx -s reload一旦master程序接收到重載配置文件的信號,它首先會檢查新的配置文件是否有語法錯誤,如果沒有錯誤,master進程將會採用新的配置,並啟動新的worker進程,同時通知舊的worker進程讓他們停止工作。否則,若設定檔存在錯誤,那麼master進程仍然使用舊的配置,並且舊的worker進程將繼續保持工作。一旦master進程通知worker進程停止工作,worker進程首先會停止接收鏈接,然後處理完當前的所有請求,之後再exit,結束執行。 🎜🎜🎜 🎜 以上就介紹了nginx基本介紹(基於官方文件),包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。 🎜 🎜 🎜