惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - 陈达辉

win10安装redis 基于SpringBoot的在线教育系统【源码开源】【建议收藏】 - 陈达辉 eduYouke在线教育点播系统 解决ThinkPHP6 控制器不存在:app\controller\Index - 陈达辉 - 博客园 ubuntu下安装YApi 低版本idea中SpringBoot项目启动失败,提示找不到 javax/servlet/ServletContext类 安装pip install pymysql碰到的问题,升级pip报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vZoYWX/pip/ python 服务器后台运行 Git冲突:commit your changes or stash them before you can merge. 解决办法 安装node、vue相关问题 初学JAVA-10-java代码的组织结构 IntelliJ IDEA 2020.2 破解版(附永久破解激活方法)Java开发者必备的神器 laravel观察者模式使用及注意事项 本地连接虚拟机redis,解决redis connection refused: connect问题 linux如何删除php7 使用vscode开发php nginx: [emerg] open() "/etc/nginx/fastcgi.conf" failed ubuntu php7.2安装php-redis扩展 Ubuntu16.04安装Redis
nginx -s reload 与 service nginx restart 的区别
陈达辉 · 2021-09-27 · via 博客园 - 陈达辉

官方文档:https://nginx.org/en/docs/beginners_guide.html

1. 语法
nginx -s signal

signal 的值如下:
stop:fast shutdown,快速的停止 nginx
quit:graceful shutdown,不再接受新的请求,等正在处理的请求出完成后在进行停止(优雅的关闭)
reload:reloading the configuration file,重新加载配置文件
reopen:reopening the log files,重新写入日志文件

2. 两者区别
nginx -s reload (热重载):Nginx 服务不会终止,使用主进程检查配置,如果配置文件语法正确,则主进程会启动一个新的工作进程处理新来的请求。主进程发送消息给原来的工作进程,通知旧的进程不在接受请求,处理完现有的请求后退出(优雅退出);如果语法不正确,则继续使用旧的进程继续处理请求。

service nginx restart(重启):该条命令的执行过程如下,nginx -s stop -> nginx 先将 Nginx 快速的停止(等同于 service nginx stop),然后在执行启动命令(等同于 service nginx start),启动的时候会造成短暂的服务中断;如果配置文件语法错误,那问题就大了,有可能会造成更长时间的中断,有可能会造成很大的宕机。

3. 注意事项
如果是正式环境需要修改配置文件时,先把原有的配置文件备份一下,然后在进行修改;修改完成后先通过 nginx -t 检查一下配置文件是否有错误,如果没有的话再进行 nginx -s reload 热加载.

如果要求停止 Nginx 或者是 释放 Nginx 资源时,我们才使用 service nginx stop 或 service nginx restart 命令,否则一般都是用 nginx -s reload。