zoukankan      html  css  js  c++  java
  • Linux-Nginx-关闭进程

    当然就仅仅是介绍一条命令了,就这么简单。


    nginx默认创建一个工作进程

    root      2713     1  0 07:56 ?        00:00:00 nginx: master process ../sbin/nginx
    nobody    2714  2713  0 07:56 ?        00:00:00 nginx: worker process
    

    改动worker_processes=10。来创建多个进程

    #user  nobody;
    worker_processes  10;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    pid        logs/nginx.pid;
    
    events {
        worker_connections  1024;
    }

    fuhui@ubuntu:/usr/local/nginx$ ps -ef | grep 'nginx' 
    root      2713     1  0 07:56 ?        00:00:00 nginx: master process ../sbin/nginx
    nobody    2747  2713  0 08:00 ?

    00:00:00 nginx: worker process nobody 2748 2713 0 08:00 ? 00:00:00 nginx: worker process nobody 2749 2713 0 08:00 ? 00:00:00 nginx: worker process nobody 2750 2713 0 08:00 ? 00:00:00 nginx: worker process nobody 2751 2713 0 08:00 ?

    00:00:00 nginx: worker process nobody 2752 2713 0 08:00 ? 00:00:00 nginx: worker process nobody 2753 2713 0 08:00 ?

    00:00:00 nginx: worker process nobody 2754 2713 0 08:00 ?

    00:00:00 nginx: worker process nobody 2755 2713 0 08:00 ?

    00:00:00 nginx: worker process nobody 2756 2713 0 08:00 ? 00:00:00 nginx: worker process fuhui 2852 2332 0 08:29 pts/6 00:00:00 grep --color=auto nginx


    错误的运行方式
    fuhui@ubuntu:/usr/local/nginx$ sudo ps -ef | grep 'nginx' | awk '{kill -9 $2}' 
    
    
    正确的运行方式
    fuhui@ubuntu:/usr/local/nginx$ sudo kill ` ps -ef | grep 'nginx' | awk '{print  $2}' `

    To kill all Nginx Processes

    kill $(ps aux | grep '[n]ginx' | awk '{print $2}')
    

    使用“跟$()效果是一样的

  • 相关阅读:
    WEB测试总结 (架构,设计)精华部分(转)
    javascript的拖放入门
    javascript十个最常用的自定义函数 (转)
    common.css
    c#中DateTime类
    PHP网站开发方案实例
    PHP框架 DooPHP 1.2 发布
    0 WINDOWS系统 + Apache +PHP5 +Zend + MySQL + phpMyAdmin安装方法(视频教程)
    IE8 CSS兼容性记录(转)
    在网站测试中如何做好安全性测试
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/5338935.html
Copyright © 2011-2022 走看看