zoukankan      html  css  js  c++  java
  • nginx启动、关闭、重启

    1、启动

    [root@localhost local]# nginx/sbin/nginx   #启动
    [root@localhost local]# nginx/sbin/nginx  -t  #检查配置文件是否正确
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    [root@localhost local]# netstat -ntlp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
    tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      2756/nginx          

    2、停止

    [root@localhost sbin]# ps -ef | grep nginx   #查询nginx主程序号,在进程列表里找master进程,它的编号就是主进程号。
    root      2811     1  0 17:52 ?        00:00:00 nginx: master process ./nginx
    nobody    2838  2811  0 17:57 ?        00:00:00 nginx: worker process
    root     27504  2707  0 19:07 pts/0    00:00:00 grep nginx
    [root@localhost sbin]# kill -quit 2811  #从容停止nginx
    [root@localhost sbin]# ps -ef | grep nginx 
    root     27513  2707  0 19:08 pts/0    00:00:00 grep nginx
    

      快速停止   kill -TERM 主进程号

      强制停止   kill -9 nginx 

    3、重启

      如果更改了配置就要重启Nginx,要先关闭Nginx再打开?可以向Nginx 发送信号,平滑重启。
      平滑重启命令:
      kill -HUP 主进程号或进程号文件路径

      或者使用

      /usr/nginx/sbin/nginx -s reload

      注意,修改了配置文件后最好先检查一下修改过的配置文件是否正确,以免重启后Nginx出现错误影响服务器稳定运行。判断Nginx配置是否正确命令如下:
      nginx -t -c /usr/nginx/conf/nginx.conf

      或者

      /usr/nginx/sbin/nginx -t
  • 相关阅读:
    kaggle之员工离职分析
    Titanic幸存预测分析(Kaggle)
    学习python,第五篇
    VLAN入门知识
    复习下VLAN的知识
    复习下网络七层协议
    学习python,第四篇:Python 3中bytes/string的区别
    学习python,第三篇:.pyc是个什么鬼?
    学习python,第二篇
    学习python,第一篇
  • 原文地址:https://www.cnblogs.com/tianxintian22/p/5586558.html
Copyright © 2011-2022 走看看