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 查看编译参数

  • 相关阅读:
    Android 自定义 ListView 上下拉动刷新最新和加载更多
    Android Activity 及其子类
    MySQL INSERT插入条件判断:如果不存在则插入
    MySQL中函数CONCAT及GROUP_CONCAT
    数据权限的设计与实现
    shiro过滤器过滤属性含义
    shiro注解
    python中,花括号,中括号,小括号的区别
    SpringBoot项目eclipse运行正常maven install打包启动后报错ClassNotFoundException
    Nginx对某个目录或整个网站进行登录认证的方法
  • 原文地址:https://www.cnblogs.com/HKUI/p/5645149.html
Copyright © 2011-2022 走看看