何时重新启动而不重新加载Nginx? [英] When to restart and not reload Nginx?

查看:101
本文介绍了何时重新启动而不重新加载Nginx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

何时需要重新启动nginx并且重新加载不足?
如果使用了 passenger 这样的扩展名,会有所不同吗?

如果服务占用太多内存,是否应该重新启动该服务.还有其他重启Nginx的原因,尤其是在扩展或Nginx核心配置中更改配置后?

更改配置后,可以通过 binary 本身或Ubuntu上的init.d脚本"/etc/init.d/nginx -h".哪种方法应该首选?

解决方案

重新加载nginx比重新启动更安全,因为在旧进程终止之前,新配置文件将被解析,并且如果有任何问题,则整个进程都将中止. /p>

另一方面,当重新启动nginx时,由于语法错误,您可能会遇到nginx停止并且不会再次重新启动的情况.

重新加载会终止旧进程,因此无论如何都应清除所有内存泄漏.

When is it necessary to restart nginx and reload will not suffice?
Does it make a difference if an extension like passenger is used?

Should the service be restarted if it consumes too much memory. Any other reasons for restarting Nginx, particularly after a configuration change either in an extension or a Nginx core config?

After making a configuration change, one can either restart or reload nginx, via the binary itself or the init.d script "/etc/init.d/nginx -h" on Ubuntu. Which method should be preferred?

解决方案

Reloading nginx is safer than restarting because before old process will be terminated, new configuration file is parsed and whole process is aborted if there are any problems with it.

On the other hand when you restart nginx you might encounter situation in which nginx will stop, and won't start back again, because of syntax error.

Reloading terminates the old process, so any memory leaks should be cleared anyway.

这篇关于何时重新启动而不重新加载Nginx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆