首页 / NGINX / nginx基本介绍(基于官方文档)
nginx基本介绍(基于官方文档)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了nginx基本介绍(基于官方文档),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3555字,纯文字阅读大概需要6分钟。
内容图文
![nginx基本介绍(基于官方文档)](/upload/InfoBanner/zyjiaocheng/155/1a6b6f657e5f4524a156bb59f9e5259c.jpg)
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, or /usr/local/etc/nginx.
nginx以及相关模块的工作方式通过配置文件来指定。默认情况下,配置文件命名为nginx.conf,位于/usr/local/nginx/conf 或 /etc/nginx 或 /usr/local/etc/nginx 路径下。
以下内容为nginx启动,关闭,重载配置文件的相关操作
Starting, Stopping, and Reloading Configuration
To start nginx, run the executable file. Once nginx is started, it can be controlled by invoking the executable with the -s
parameter. Use the following syntax:
nginx -s signal
Where signal may be one of the following:
stop
— fast shutdownquit
— graceful shutdownreload
— reloading the configuration filereopen
— reopening the log files
For example, to stop nginx processes with waiting for the worker processes to finish serving current requests, the following command can be executed:
nginx -s quit
This command should be executed under the same user that started nginx.
Changes made in the configuration file will not be applied until the command to reload configuration is sent to nginx or it is restarted. To reload configuration, execute:
nginx -s reload
Once the master process receives the signal to reload configuration, it checks the syntax validity of the new configuration file and tries to apply the configuration provided in it. If this is a success, the master process starts new worker processes and sends messages to old worker processes, requesting them to shut down. Otherwise, the master process rolls back the changes and continues to work with the old configuration. Old worker processes, receiving a command to shut down, stop accepting new connections and continue to service current requests until all such requests are serviced. After that, the old worker processes exit.
一旦启动了nginx,就可以通过nginx -s [signal]命令的方式来控制nginx.其中[signal]可以为如下的命令:
stop
— 快速停止quit
— 平滑关闭reload
— 重新加载配置文件reopen
— 重新打开日志文件
nginx -s quit
当配置文件被更改,只有当nginx被重启或者接收到重载配置文件的命令时新的配置才会生效,为了更改配置文件后生效,可以使用
nginx -s reload
一旦master进程接收到重载配置文件的信号,它首先会检查新的配置文件是否有语法错误,如果没有错误,master进程将会采用新的配置,并启动新的worker进程,同时通知旧的worker进程让他们停止工作。否则,若配置文件存在错误,那么master进程仍然使用旧的配置,并且旧的worker进程将继续保持工作。一旦master进程通知worker进程停止工作,worker进程首先会停止接收链接,然后处理完当前的所有请求,之后再exit,结束执行。
以上就介绍了nginx基本介绍(基于官方文档),包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
内容总结
以上是互联网集市为您收集整理的nginx基本介绍(基于官方文档)全部内容,希望文章能够帮你解决nginx基本介绍(基于官方文档)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。