zoukankan      html  css  js  c++  java
  • nginx启动停止

    查看 nginx进程  ps -ef|grep nginx

    如果开启了就会出现类似下面的

    root 2700 1 0 09:35 ? 00:00:00 nginx: master process nginx -c /etc/nginx/nginx.conf
    nginx 2701 2700 0 09:35 ? 00:00:00 nginx: worker process

    如果没开启

    /usr/local/nginx-1.8.0/sbin/nginx -c /usr/local/nginx-1.8.0/conf/nginx.conf

    用-c 指定配置文件  也可以不指定

    /usr/local/nginx-1.8.0/sbin/nginx -t -c /usr/local/nginx-1.8.0/conf/nginx.conf    

    -t来测试配置文件是否正确

    [root@localhost110 sbin]# /usr/local/nginx-1.8.0/sbin/nginx -t -c /usr/local/nginx-1.8.0/conf/nginx.conf
    nginx: the configuration file /usr/local/nginx-1.8.0/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx-1.8.0/conf/nginx.conf test is successful

    开启之后

    [root@localhost110 sbin]# ps -ef|grep nginx
    root 5198 1 0 09:45 ? 00:00:00 nginx: master process /usr/local/nginx-1.8.0/sbin/nginx -c /usr/local/nginx-1.8.0/conf/nginx.conf
    www 5199 5198 0 09:45 ? 00:00:00 nginx: worker process
    root 5204 2612 0 09:45 pts/0 00:00:00 grep nginx

         从容停止   kill -QUIT 主进程号

      快速停止   kill -TERM 主进程号

      强制停止   kill -9 nginx

    若nginx.conf配置了pid文件路径,如果没有,则在logs目录下

    kill -信号类型 '/usr/local/nginx-1.8.0/logs/nginx.pid'

    修改完配置文件  /usr/local/nginx-1.8.0/sbin/nginx  -s reload

    升级

    1、先用新程序替换旧程序文件

    2、kill -USR2 旧版程序的主进程号或者进程文件名

     此时旧的nginx主进程会把自己的进程文件改名为.oldbin,然后执行新版nginx,此时新旧版本同时运行

    3、kill -WINCH 旧版本主进程号

    4、不重载配置启动新/旧工作进程

      kill -HUP 旧/新版本主进程号

      从容关闭旧/新进程

      kill -QUIT 旧/新进程号

      快速关闭旧/新进程

      kill -TERM 旧/新进程号

    nginx -v  查看版本信息

    nginx  -V 查看编译参数

  • 相关阅读:
    170829-关于AOP面向切面编程
    170826-关于spring的知识点及练习
    170814-17关于javaweb的知识点
    scrapy之手机app抓包爬虫
    tornado之WebSocket
    Tornado异步(2)
    tornado异步(1)
    爬虫之动态HTML处理(Selenium与PhantomJS )动态页面模拟点击
    爬虫之动态HTML处理(Selenium与PhantomJS )执行 JavaScript 语句
    爬虫之动态HTML处理(Selenium与PhantomJS )网站模拟登录
  • 原文地址:https://www.cnblogs.com/HKUI/p/5645149.html
Copyright © 2011-2022 走看看