如何不重启服务使配置生效?

那只能重载啊!

重新加载会告诉服务重新加载其配置文件,但保持相同的进程运行。重新启动会告诉它完全关闭,然后重新启动。

  • 一些支持该reload命令的服务可以重新加载其配置,而不必完全关闭并重新启动。
  • Postfix和Apache一样。如果你需要对活动服务器进行配置更改而不会导致停机几秒钟,这非常有用。

系统:RHEL 7

RHEL 7系统中是使用systemctl命令来管理服务的。

RHEL 6系统     RHEL 7系统

service 服务名称  start   systemctl  start        启动服务
service 服务名称  restart     systemctl  restart    重启服务
service 服务名称  stop      systemctl  stop        关闭服务
service 服务名称  reload   systemctl  status      重新加载服务
service 服务名称  status      systemctl  enable      查看服务状态

如nginx:服务 + 命令。

  1. 启动 :

start nginx
或者:
nginx.exe

  1. 停止 :

nginx.exe -s stop (快速停止,可能损失数据)

nginx.exe -s quit (完全停止,不损失数据)

  1. 重载 (更新配置文件后需要重载使得生效):

nginx.exe -s reload

当你以为毫无希望的时候,或许正是希望到来的时候,尽力而为,加油!

猜你喜欢

转载自blog.csdn.net/qq_42707739/article/details/105301233